Hi.
On my Linux RedHat 8 system, I can't obtain dates earlier than 1970 with PHP.
That is, when feeding a function that turns dfates into unixtime, such as
mktime() and strtotime()
print date("Y-m-d", mktime(0,0,0,1, 1,1930));
-> "1969-12-31" (since the result of mktime is "-1")
But date() gets it though, so if I do
print date("Y-m-d", -1000000000);
-> "1938-04-24"
Now, presumably this has something to do with Linux instead of PHP, since doing
this in MySQL doesn't work either:
select unix_timestamp( '1935-12-03');
-> 0
But, when using perl, it works just fine when using Date::Manip:
#!/usr/bin/perl
use Date::Manip;
$date = UnixDate("1945-01-23", "%s");
print $date;
-> -787021200
So, how come MySQL can't do it, PHP can't do it, but somehow perl can? Can I
compile PHP with negative integer date support?
--
Sandman[.net]
On my Linux RedHat 8 system, I can't obtain dates earlier than 1970 with PHP.
That is, when feeding a function that turns dfates into unixtime, such as
mktime() and strtotime()
print date("Y-m-d", mktime(0,0,0,1, 1,1930));
-> "1969-12-31" (since the result of mktime is "-1")
But date() gets it though, so if I do
print date("Y-m-d", -1000000000);
-> "1938-04-24"
Now, presumably this has something to do with Linux instead of PHP, since doing
this in MySQL doesn't work either:
select unix_timestamp( '1935-12-03');
-> 0
But, when using perl, it works just fine when using Date::Manip:
#!/usr/bin/perl
use Date::Manip;
$date = UnixDate("1945-01-23", "%s");
print $date;
-> -787021200
So, how come MySQL can't do it, PHP can't do it, but somehow perl can? Can I
compile PHP with negative integer date support?
--
Sandman[.net]
Comment