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
Post a Comment