Skip to content

Instantly share code, notes, and snippets.

@patch
Created August 27, 2014 19:11
Show Gist options
  • Save patch/04c3e8ad885062e1f479 to your computer and use it in GitHub Desktop.
Save patch/04c3e8ad885062e1f479 to your computer and use it in GitHub Desktop.
PHP localized date/time
$date_fmt = new IntlDateFormatter(
'pt-BR',
IntlDateFormatter::SHORT,
IntlDateFormatter::SHORT,
'America/New_York',
IntlDateFormatter::GREGORIAN,
);
# $date may be DateTime object, IntlCalendar object, seconds since epoch, or localtime array
$formatted = $date_fmt->format($date);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment