Skip to content

Instantly share code, notes, and snippets.

@pedro-stanaka
Created March 26, 2018 15:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pedro-stanaka/6193da02f544674f81db5f2f5fcd2b82 to your computer and use it in GitHub Desktop.
Save pedro-stanaka/6193da02f544674f81db5f2f5fcd2b82 to your computer and use it in GitHub Desktop.
<?php
if (!isset(static::$_formatters[$key])) {
if ($timezone === '+00:00' || $timezone === 'Z') {
$timezone = 'UTC';
} elseif ($timezone[0] === '+' || $timezone[0] === '-') {
$timezone = 'GMT' . $timezone;
}
static::$_formatters[$key] = datefmt_create(
$locale,
$dateFormat,
$timeFormat,
$timezone,
$calendar,
$pattern
);
}
return static::$_formatters[$key]->format($date->format('U'));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment