Thursday 15 September 2011

php - how to format the mongoDate function properly -



php - how to format the mongoDate function properly -

i not sure if i'm doing right, date function seems display correctly, reason returning time in not pm, example,

right now, if create new date using:

$time = new mongodate();

then save on info base, in record displays so:

isodate("2014-10-22t00:22:34.619z")

am assuming there's i'm not doing correctly, when format it, using:

date('d m, y h:ia', $time->sec)

it display so:

22 oct, 2014 12:22am

i'm hoping extremely obvious, can tell in isodate, it's displaying in time, question is, why storing in , not pm?

$time->sec has unix timestamp. when utilize timestamp in date() function, formated date based on set timezone. why getting 12hour difference.

$dt = new datetime("@" . $time->sec); // datetime instance in z (zulu) timezone print_r($dt); // print object $dt->settimezone(new datetimezone('... set timezone ...')); print_r($dt); // print object

php mongodb date format mongodate

No comments:

Post a Comment