2018-09-21 22:11:49 +02:00
|
|
|
<?php namespace Todaymade\Daux;
|
|
|
|
|
|
|
|
use IntlDateFormatter;
|
|
|
|
|
|
|
|
class FormatDate
|
|
|
|
{
|
2020-04-22 21:55:53 +02:00
|
|
|
public static function format($config, $date)
|
|
|
|
{
|
2019-12-05 21:25:58 +01:00
|
|
|
$locale = $config->getLanguage();
|
2018-09-21 22:11:49 +02:00
|
|
|
$datetype = IntlDateFormatter::LONG;
|
|
|
|
$timetype = IntlDateFormatter::SHORT;
|
|
|
|
$timezone = null;
|
|
|
|
|
|
|
|
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
|
|
|
}
|