Add translation of modified_at time, using php-intl

This commit is contained in:
Stéphane Goetz
2018-09-21 22:11:49 +02:00
bovenliggende 3982139892
commit d93ad8c6b1
9 gewijzigde bestanden met toevoegingen van 333 en 123 verwijderingen

22
libs/FormatDate.php Normal file
Bestand weergeven

@ -0,0 +1,22 @@
<?php namespace Todaymade\Daux;
use IntlDateFormatter;
class FormatDate
{
public static function format($params, $date) {
$locale = $params['language'];
$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);
}
}