php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #46009 mktime giving strange problem
Submitted: 2008-09-06 15:14 UTC Modified: 2008-09-06 15:42 UTC
From: siddarth at revolutesolution dot com Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 5.2.6 OS: Linux
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: siddarth at revolutesolution dot com
New email:
PHP Version: OS:

 

 [2008-09-06 15:14 UTC] siddarth at revolutesolution dot com
Description:
------------
Hi,
I am making a counting system, which will told visitor to a days difference within selected date range.

If user enter date till 2038 it works fine..and user enter beyond then this, then it start giving error (negative values)

I read that due to PHP version problem it did, but we have "PHP Version 5.2.5" installed on the server.

Can you please suggest about this error.

Reproduce code:
---------------
For your reference, i am using following code:

$dateDiff = mktime( $from['hour']  , $from['minutes'] , $from['seconds'] , 
                        $from['month'] , $from['day']     , $from['year'] ) -
                mktime( $to['hour']    , $to['minutes']   , $to['seconds'] ,
                        $to['month']   , $to['day']       , $to['year'] );

	$intDays    = floor(  $dateDiff / (60*60*24) );

    $intHours   = floor( ($dateDiff - ($intDays*60*60*24) ) / (60*60) );

    $intMinutes = floor( ($dateDiff - ($intDays*60*60*24) - ($intHours*60*60) ) /60 );



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-09-06 15:42 UTC] jani@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.


 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue Jul 08 03:01:32 2025 UTC