white_thesis (white_thesis) wrote in ru_php,
white_thesis
white_thesis
ru_php

strtotime

Сколько-сколько это у нас секунд в году, как вы думаете?

for($y=1970; $y<2038; $y++)
{
$y1 = $y+1;
$t = strtotime("$y1-01-01 00:00:00") - strtotime("$y-01-01 00:00:00");
echo "$y - $y1 = $t s =", $t/3600/24, " d\r\n";
};


1970 - 1971 = 31536000 s =365 d
1971 - 1972 = 31536000 s =365 d
1972 - 1973 = 31622400 s =366 d
1973 - 1974 = 31536000 s =365 d
1974 - 1975 = 31536000 s =365 d
1975 - 1976 = 31536000 s =365 d
1976 - 1977 = 31622400 s =366 d
1977 - 1978 = 31536000 s =365 d
1978 - 1979 = 31536000 s =365 d
1979 - 1980 = 31536000 s =365 d
1980 - 1981 = 31622400 s =366 d
1981 - 1982 = 31536000 s =365 d
1982 - 1983 = 31536000 s =365 d
1983 - 1984 = 31536000 s =365 d
1984 - 1985 = 31622400 s =366 d
1985 - 1986 = 31536000 s =365 d
1986 - 1987 = 31536000 s =365 d
1987 - 1988 = 31536000 s =365 d
1988 - 1989 = 31622400 s =366 d
1989 - 1990 = 31536000 s =365 d
1990 - 1991 = 31536000 s =365 d
1991 - 1992 = 31539600 s =365.04166666667 d
1992 - 1993 = 31618800 s =365.95833333333 d
1993 - 1994 = 31536000 s =365 d
1994 - 1995 = 31536000 s =365 d
1995 - 1996 = 31536000 s =365 d
1996 - 1997 = 31622400 s =366 d
1997 - 1998 = 31536000 s =365 d
1998 - 1999 = 31536000 s =365 d
1999 - 2000 = 31536000 s =365 d
2000 - 2001 = 31622400 s =366 d
2001 - 2002 = 31536000 s =365 d
2002 - 2003 = 31536000 s =365 d
2003 - 2004 = 31536000 s =365 d
2004 - 2005 = 31622400 s =366 d
2005 - 2006 = 31536000 s =365 d
2006 - 2007 = 31536000 s =365 d
2007 - 2008 = 31536000 s =365 d
2008 - 2009 = 31622400 s =366 d
2009 - 2010 = 31536000 s =365 d
2010 - 2011 = 31536000 s =365 d
2011 - 2012 = 31532400 s =364.95833333333 d
2012 - 2013 = 31622400 s =366 d
2013 - 2014 = 31536000 s =365 d
2014 - 2015 = 31536000 s =365 d
2015 - 2016 = 31536000 s =365 d
2016 - 2017 = 31622400 s =366 d
2017 - 2018 = 31536000 s =365 d
2018 - 2019 = 31536000 s =365 d
2019 - 2020 = 31536000 s =365 d
2020 - 2021 = 31622400 s =366 d
2021 - 2022 = 31536000 s =365 d
2022 - 2023 = 31536000 s =365 d
2023 - 2024 = 31536000 s =365 d
2024 - 2025 = 31622400 s =366 d
2025 - 2026 = 31536000 s =365 d
2026 - 2027 = 31536000 s =365 d
2027 - 2028 = 31536000 s =365 d
2028 - 2029 = 31622400 s =366 d
2029 - 2030 = 31536000 s =365 d
2030 - 2031 = 31536000 s =365 d
2031 - 2032 = 31536000 s =365 d
2032 - 2033 = 31622400 s =366 d
2033 - 2034 = 31536000 s =365 d
2034 - 2035 = 31536000 s =365 d
2035 - 2036 = 31536000 s =365 d
2036 - 2037 = 31622400 s =366 d
2037 - 2038 = 31536000 s =365 d


PHP Version 5.3.13
Windows NT MIKE 5.1 build 2600 (Windows XP Professional Service Pack 3) i586

"Olson" Timezone Database Version 2012.3
Timezone Database internal
Default timezone Europe/Moscow

Да ети же твою мать!
19-ое января 2011 года по его мнению содержит 82800 секунд = 23 часа.
А в какие-то дни - 25 часов.

Косяк ошибок с 1981 под 2011 годы, в основном - апрель и сентябрь.

На другой системе все корректно считается.
PHP Version 5.2.17
System FreeBSD NQ_meteodata 9.0-RELEASE FreeBSD 9.0-RELEASE #0: Tue Jan 3 07:15:25 UTC 2012 root@obrian.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC i386

"Olson" Timezone Database Version 2011.13
Timezone Database internal
Default timezone UTC
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 22 comments