-
-
Save klapuch/7e427031de7b81440d8d2acea1f6f15e 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