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

user interface - Python attempting to create a simple gui, getting "AttributeError: 'MainMenu' object has no attribute 'intro_screen'" -

jquery - Common JavaScript snippet to share files on Google Drive, Dropbox, Box.net or SkyDrive -

Android Gson.fromJson error -