Re: handling dates before 1901

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Gabriel Kuri wrote:
I recently migrated some php scripts from a box running php 4.4.4 to php
5.2.5. due to the nature of the data, some of the php scripts require
handling dates before 1901. both boxes are 64-bit (original and new),
however the new box isn't handling dates properly before 1901 with
either the mktime() or strtotime() functions. it was working perfectly
on the old box and I'm stumped as to why it stopped working on the new
one. did the mktime() and strtotime() functions in php 5 regress to
handling the dates as 32-bit ints?

here's an example of some php code to test between the two boxes:

<?php

echo "12-13-1901: ".mktime(0,0,0, 12, 13, 1901)."\n";
echo "12-14-1901: ".mktime(0,0,0, 12, 14, 1901)."\n";

echo "1-18-2038: ".mktime(0,0,0, 1, 18, 2038)."\n";
echo "1-19-2038: ".mktime(0,0,0, 1, 19, 2038)."\n";

echo "12-13-1901: ".strtotime("12/13/1901")."\n";
echo "12-14-1901: ".strtotime("12/14/1901")."\n";

?>


output of code on old box:

	12-13-1901: -2147529600
	12-14-1901: -2147443200
	1-18-2038: 2147414400
	1-19-2038: 2147500800
	12-13-1901: -2147529600
	12-14-1901: -2147443200

output of code on new box:

	12-13-1901:
	12-14-1901: -2147443200
	1-18-2038: 2147414400
	1-19-2038:
	12-13-1901:
	12-14-1901: -2147443200

thanks much ...


-----
Gabriel Kuri | Sr. Network Engineer
Instructional and Information Technology Division California State Polytechnic University, Pomona http://www.csupomona.edu/~iit | +1 909 979 6363

same os on both boxes? + which versions

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux