Connecting Tech Pros Worldwide Forums | Help | Site Map

mktime and negative timestamps (on linux, not windows).

Sugapablo
Guest
 
Posts: n/a
#1: Jul 26 '05
From the manual, it seems negative timestamps should work on Linux, just
not Windows.

But anything I try before 1970, (i.e. a negative timestamp) is giving me
12/31/1969.

Is this right?

--
[ Sugapablo ]
[ http://www.sugapablo.net <--personal | http://www.sugapablo.com <--music ]
[ http://www.2ra.org <--political | http://www.subuse.net <--discuss ]


Peter van Schie
Guest
 
Posts: n/a
#2: Jul 26 '05

re: mktime and negative timestamps (on linux, not windows).


Sugapablo wrote:[color=blue]
> From the manual, it seems negative timestamps should work on Linux, just
> not Windows.
>
> But anything I try before 1970, (i.e. a negative timestamp) is giving me
> 12/31/1969.
>
> Is this right?
>[/color]

Yes mktime doesn't support dates before 1970 and after 2037.
If you really need it, you could use an extension like:
http://nl2.php.net/calendar

--
http://www.phpforums.nl
Carl
Guest
 
Posts: n/a
#3: Jul 26 '05

re: mktime and negative timestamps (on linux, not windows).


Sugapablo wrote:[color=blue]
> From the manual, it seems negative timestamps should work on Linux, just
> not Windows.
>
> But anything I try before 1970, (i.e. a negative timestamp) is giving me
> 12/31/1969.
>
> Is this right?
>[/color]

How exactly are you setting the timestamp value?

The following works fine for me (FreeBSD):

$timeStamp = mktime(0, 0, 1, 1, 1, 1965);
echo date("l dS of F Y h:i:s A", $timeStamp);

prints "Friday 01st of January 1965 12:00:01 AM"
Closed Thread


Similar PHP bytes