8
0
daux.io/libs/FormatDate.php

24 Zeilen
540 B
PHP

<?php namespace Todaymade\Daux;
use IntlDateFormatter;
class FormatDate
{
2020-04-22 21:55:53 +02:00
public static function format($config, $date)
{
$locale = $config->getLanguage();
$datetype = IntlDateFormatter::LONG;
$timetype = IntlDateFormatter::SHORT;
$timezone = null;
2020-04-22 22:24:52 +02:00
if (!extension_loaded('intl')) {
$locale = 'en';
$timezone = 'GMT';
}
$formatter = new IntlDateFormatter($locale, $datetype, $timetype, $timezone);
return $formatter->format($date);
}
2020-04-22 21:55:53 +02:00
}