Good afternoon! I have a simple question. I have a date format in PHP $ originalDate = "22/08/2015 20:36"; How to translate 2015-08-20 00:00:00 ?
Asked
Active
Viewed 68 times
-2
-
Use `date` function. – u_mulder Aug 22 '15 at 18:08
-
I do not really understand how to do it – user2792900 Aug 22 '15 at 18:09
-
2Then read this http://stackoverflow.com/questions/2167916/convert-one-date-format-into-another-in-php?rq=1 – u_mulder Aug 22 '15 at 18:11
1 Answers
0
Try this:
<?php
$originalDate = "22/08/2015 20:36";
$date = DateTime::createFromFormat('d/m/Y H:i', $originalDate);
echo $date->format('Y-m-d H:i:s');
?>

Eduardo Macêdo
- 380
- 4
- 10