Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to convert this date format in php?

I receive this date format from facebook and google docs:

2011-02-25T10:55:25+0000

How can I convert it to something like

25/02/2011 10:55:25
like image 457
Christophe Avatar asked Dec 10 '22 10:12

Christophe


1 Answers

<?php

$date = new DateTime('2011-02-25T10:55:25+0000');

print $date->format('d/m/Y H:i:s');

?>

Please don't forget to set the correct time zone with this example. Refer to the datetime documentation on the php.net site for more details.

like image 172
Simon H Avatar answered Dec 21 '22 02:12

Simon H