Created
October 7, 2016 00:47
-
-
Save EliuTimana/b1932e1981f438ba10ea749857688e86 to your computer and use it in GitHub Desktop.
day/month/year to year-month-day in PHP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// 27/5/2016 | |
$fecha = str_replace('/','-', '27/05/2016'); // String -> 27-05-2016 | |
$fecha = strtotime($fecha); //1464332400 | |
$fecha = date('Y-m-d',$fecha); //String -> 2016-05-27 | |
$fecha = date_create($fecha); //2016-05-27 00:00:00.000000 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment