Skip to content

Instantly share code, notes, and snippets.

@nyamsprod
Last active June 15, 2016 14:22
Show Gist options
  • Save nyamsprod/cc5e9692284864a6a20345a47c4a536f to your computer and use it in GitHub Desktop.
Save nyamsprod/cc5e9692284864a6a20345a47c4a536f 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