php new dateTime and gmdate -


this question has answer here:

how convert following uses datetime class?:

array(     'post_date' => date('y-m-d h:i:s', $date),     'post_date_gmt' => gmdate('y-m-d h:i:s', $date), ); 

eg part easy how gmdate?

$odate = new datetime($date); array(     'post_date' => $odate->format('y-m-d h:i:s'),     'post_date_gmt' => gmdate('y-m-d h:i:s', $date), ); 

in case need 2 object 1 gmt.

$odate = new datetime($date); $gmdate = new datetime($date, new datetimezone('gmt'));  array(    'post_date'     => $odate->format('y-m-d h:i:s'),    'post_date_gmt' => $gmdate->format('y-m-d h:i:s'), ); 

Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -