Skip to content

Instantly share code, notes, and snippets.

@klapuch
Forked from nyamsprod/dateformatting-intl.php
Created June 15, 2016 14:22
Show Gist options
  • Save klapuch/7e427031de7b81440d8d2acea1f6f15e to your computer and use it in GitHub Desktop.
Save klapuch/7e427031de7b81440d8d2acea1f6f15e to your computer and use it in GitHub Desktop.
Formatting Date in PHP
<?php
echo IntlDateFormatter::formatObject(
new DateTime(), //a DateTime object
"eeee dd MMMM yyyy '@' hh:mm:ss", //UCI standard formatted string
'fr_FR' //the locale
);
<?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
<?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