powered by simpleCommunicator - 2.0.60     © 2026 Programmizd 02
Целевая тема:
Создать новую тему:
Автор:
Закрыть
Цитировать
Форумы / PHP, Perl, Python [игнор отключен] [закрыт для гостей] / strtotime() и date() странно преобразуют даты
4 сообщений из 4, страница 1 из 1
strtotime() и date() странно преобразуют даты
    #38447787
Uncle Roma
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Есть такой простенький код.

Код: php
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
<?php
$ch1 = '26.12.10';
echo $ch1.'<br>';
echo date('Y-m-d H:i:s', strtotime($ch1));
echo '<br><br>';

$ch2 = '19.11.06';
echo $ch2.'<br>';
echo date('Y-m-d H:i:s', strtotime($ch2));
?>



Вот результат его работы:
26.12.10

Warning: strtotime(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in D:\WebServers\home\localhost\www\syst\Ora2MySQL\date_bug.php on line 4

Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in D:\WebServers\home\localhost\www\syst\Ora2MySQL\date_bug.php on line 4
2010-12-26 00:00:00

19.11.06

Warning: strtotime(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in D:\WebServers\home\localhost\www\syst\Ora2MySQL\date_bug.php on line 9

Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in D:\WebServers\home\localhost\www\syst\Ora2MySQL\date_bug.php on line 9
2013-10-31 19:11:06

Вопрос: почему 2010-й год конвертируется нормально, а 2006-й год превращается в 2013 ?
...
Рейтинг: 0 / 0
strtotime() и date() странно преобразуют даты
    #38447796
Uncle Roma
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
P.S. Предупреждения о таймзоне убрал, вставив строку
Код: php
1.
date_default_timezone_set("Europe/Moscow"); 



Но проблему с конвертацией даты это не решило.
...
Рейтинг: 0 / 0
strtotime() и date() странно преобразуют даты
    #38447996
...
Рейтинг: 0 / 0
strtotime() и date() странно преобразуют даты
    #38448155
Uncle Roma
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
как-то так...,
спасибо за ответ, разобрался.
...
Рейтинг: 0 / 0
4 сообщений из 4, страница 1 из 1
Форумы / PHP, Perl, Python [игнор отключен] [закрыт для гостей] / strtotime() и date() странно преобразуют даты
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]