Last active
December 25, 2015 22:49
-
-
Save aahan/7053035 to your computer and use it in GitHub Desktop.
Convert date to a different format.
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 | |
| /* | |
| * Always input date in ISO 8601 format (YYYY-MM-DDThh:mm:ss.sTZD) to | |
| * allow for conversion to a different format before display. | |
| * | |
| * e.g. 1997-07-16T19:20:30.45+01:00, 1997-07-16 | |
| * | |
| * http://www.w3.org/TR/NOTE-datetime | |
| * http://php.net/manual/en/function.date.php | |
| * http://stackoverflow.com/a/5074579 | |
| */ | |
| $input_timestamp = strtotime( '1997-07-16' ); | |
| $new_date_format = date( 'F j, Y', $timestamp ); | |
| // Displays '1997-07-16' as 'July 16, 1997' | |
| echo $new_date_format; | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment