-
-
Save nyamsprod/cc5e9692284864a6a20345a47c4a536f to your computer and use it in GitHub Desktop.
Formatting Date in PHP
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 | |
echo IntlDateFormatter::formatObject( | |
new DateTime(), //a DateTime object | |
"eeee dd MMMM yyyy '@' hh:mm:ss", //UCI standard formatted string | |
'fr_FR' //the locale | |
); |
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 | |
$current = setlocale(LC_TIME, "fr_FR.UTF8"); | |
echo strftime("%A %d %B %Y @ %H:%M:%S", time()), PHP_EOL; | |
setlocale(LC_TIME, $current); //to restore the current locale for time |
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 | |
setlocale(LC_TIME, "fr_FR.UTF8"); | |
echo strftime("%A %d %B %Y @ %H:%M:%S", time()), PHP_EOL; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment