Проблема с GMT/UTC
-
Проблема в функции:
function mje_get_range_of_date($first, $last, $step = '+1 day', $format = 'Y/m/d') { date_default_timezone_get(get_option('timezone_string')); date_default_timezone_set(‘UTC’); $dates = array(); $current = strtotime($first); $last = strtotime($last); while ($current <= $last) { $dates[] = date($format, $current); $current = strtotime($step, $current); } return $dates; }
Если ставлю вместо:
date_default_timezone_get(get_option('timezone_string')); date_default_timezone_set(‘UTC’);
это:
date_default_timezone_set('Europe/Moscow');
все в порядке.
Иначе ошибки дебаггера на сайте на эти строки:
Warning: date_default_timezone_get() expects exactly 0 parameters, 1 given in
Warning: Use of undefined constant ‘UTC’ — assumed ‘‘UTC’’ (this will throw an Error in a future version of PHP) in
Warning: date_default_timezone_get() expects exactly 0 parameters, 1 given in
Warning: Use of undefined constant ‘UTC’ — assumed ‘‘UTC’’ (this will throw an Error in a future version of PHP) inКто сталкивался? Хочется чтобы GMT/UTC работало у всех пользователей как положено.
Просмотр 2 ответов — с 1 по 2 (всего 2)
Просмотр 2 ответов — с 1 по 2 (всего 2)
- Тема «Проблема с GMT/UTC» закрыта для новых ответов.