strftime workaround for php on windows
The %e and %k modifiers are not supported in the Windows implementation of the strftime function. The workaround is from the strftime documention (Example #3).
This commit is contained in:
parent
923ef7c0ef
commit
4641b5c66b
@ -72,6 +72,11 @@ namespace Translator {
|
||||
|
||||
function datetime($format, $timestamp)
|
||||
{
|
||||
if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
|
||||
$format = preg_replace('#(?<!%)((?:%%)*)%e#', '\1%#d', $format);
|
||||
$format = preg_replace('#(?<!%)((?:%%)*)%k#', '\1%#H', $format);
|
||||
}
|
||||
|
||||
return strftime($format, (int) $timestamp);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user