note 48992 added to function.mktime

From: Date: Thu, 13 Jan 2005 22:02:11 +0000
Subject: note 48992 added to function.mktime
Groups: php.notes 
Request: Send a blank email to php-notes+get-83223@lists.php.net to get a copy of this message
I am encountering an error with mktime() We are running a page to get a pickup and dropoff date for a car rental. Whenever the date March 27th 2005 is used for either the pickup or dropoff date, the calculations go crazy. I use mktime() with the pickup and dropoff dates, then use that to calculate the total number of days that the car will be rented: $start_date = mktime(0,0,0, $pickup_month, $pickup_date, $pickup_year); $end_date = mktime(0,0,0,$dropoff_month, $dropoff_date, $dropoff_year); $total_seconds = $end_date - $start_date; $number_of_nights = ceil($total_seconds/86400); Whenever March 27 2005 is entered, it returns -3662 ... which screws everything up. I have no clue why this is happening. I have tried hard coding the date into mktime(0,0,0,3,27,2005) and it still returns the same thing. Any help would be wonderful. ---- Manual Page -- http://www.php.net/manual/en/function.mktime.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+48992 Delete -- http://master.php.net/manage/user-notes.php?action=delete+48992&report=yes Reason: bad code -- http://master.php.net/manage/user-notes.php?action=delete+48992&report=yes&reason=bad+code Reason: spam -- http://master.php.net/manage/user-notes.php?action=delete+48992&report=yes&reason=spam Reason: useless example -- http://master.php.net/manage/user-notes.php?action=delete+48992&report=yes&reason=useless+example Reason: contains commercial links -- http://master.php.net/manage/user-notes.php?action=delete+48992&report=yes&reason=contains+commercial+links Reason: useless note -- http://master.php.net/manage/user-notes.php?action=delete+48992&report=yes&reason=useless+note Reject -- http://master.php.net/manage/user-notes.php?action=reject+48992&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#83223) next »