5450 Posts in 1672 Topics by 1197 members
|Go to End|
27 January 2010 at 12:30pm
SS stores Datetime like '2008-06-21 20:30:00' not as timestamp in mySQL Database. I checked this with phpMyAdmin. If I use following code, it results in "01.01.1970", no matter what date I use. Does anyone have an idea how to get a dateobject out of this string? I would prefer not to use explode, I think there must be a php function to do it. I checked the sapphire api and they also use strtotime... No clue...
Example of code:
$starttime = strtotime( $this->start );
$dateTip = date( 'd.m.Y', $starttime );
27 January 2010 at 1:09pm
Well if your field is a SSDateTime field in the database when you do $this->dbObject('FieldName') in the PHP or $FieldName in the templates it returns the full object so you can call the various methods etc.
28 January 2010 at 9:09am
Sorry, doesnÂ´t work. See, I use Datetime:
public static $db = array(
"Start" => "Datetime",
"End" => "Datetime"
Should I better use SSDatetime? If I change the field, do I loose already stored dates? Do I have to write them all again?
But I think, your solution with
$starttime = $this->dbObject( "start" );
should also work with MySQL Datetime...? Maybe I made a mistake, but where...
15 February 2010 at 11:00am
To close this thread I will tell you what finally did it:
I changed DateTime to SSDateTime and left all other code as is. It works now. Best of it: I did not have to change one single date in the database.
|Go to Top|