Created
March 15, 2014 03:15
-
-
Save joseluisq/9561383 to your computer and use it in GitHub Desktop.
Change format from string datetime
This file contains 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 | |
/** | |
* Change format from the datetime | |
* Example: changeDatetimeFormat('2014-11-02 09:11:00', 'd/m/Y H:i:s a'); | |
* | |
* @param string $datetime String datetime | |
* @param string $format String datetime format | |
* @return string | |
*/ | |
function changeDatetimeFormat($datetime, $format = 'Y-m-d H:i:s') { | |
return date($format, strtotime($datetime)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment