Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

mktime becomes -62 ?!?!

Status
Not open for further replies.

ThomasJSmart

Programmer
Sep 16, 2002
634
I know there are some problems with dates before 1970 but looking on internet these only seem to be on windows systems. our server is a linux server. Red-hat to be precies. Its running on apache 1.3 with php 4.

This is whats happening tho:

$date = "21/03/1955";
$date = explode('/',$date);
$date = mktime(11,0,0,$date[1],$date[0],$date[2]);

echo $date;

this echos -62

why why why? and how do i fix it?

Thank you,
Thomas




I learned a bit yesterday, today i learned a lot, imagine what i'll learn tomorrow!
 
There is s Caution on the PHP online manual page for mktime(), which reads:

Before PHP 5.1.0, negative timestamps were not supported under any known version of Windows and some other systems as well. Therefore the range of valid years was limited to 1970 through 2038.

The PHP online manual page for date states:

Note: The valid range of a timestamp is typically from Fri, 13 Dec 1901 20:45:54 GMT to Tue, 19 Jan 2038 03:14:07 GMT. (These are the dates that correspond to the minimum and maximum values for a 32-bit signed integer). However, before PHP 5.1 this range was limited from 01-01-1970 to 19-01-2038 on some systems (e.g. Windows).

I think if you're running a version of PHP before 5.1.0 and are handing mktime() that input, you can expect squirelly output.


What is is you're trying to do?



Want the best answers? Ask the best questions! TANSTAAFL!
 
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Sponsor

Back
Top