strange mktime

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello, im found some strange behaviour. Someone knows whats is going on or 
it is a bug?:

lets do like this:

three dates in timestamp:
27.10.2007: 1193436000
28.10.2007: 1193522400
29.10.2007: 1193612400

convert back:
1193436000: 27.10.2007 00:00:00
1193522400: 28.10.2007 00:00:00
1193612400: 29.10.2007 00:00:00

And one day is always 24 hours * 60 minutes * 60 secondes = 86400. So the 
difference between these three dates in timestamp should also be the 
same.But:
day2-day1 = 86400
day3-day2 = 90000

Here is my code, im using PHP Version 5.1.6:

echo ' three dates in timestamp: <br>';
        $day1 = mktime(0, 0, 0, 10, 27, 2007);
        $day2 = mktime(0, 0, 0, 10, 28, 2007);
        $day3 = mktime(0, 0, 0, 10, 29, 2007);

        echo '27.10.2007: '.$day1.'<br>';
        echo '28.10.2007: '.$day2.'<br>';
        echo '29.10.2007: '.$day3.'<br><br>';

        echo 'convert back: <br>';
        echo $day1.': '.date('d.m.Y H:i:s',$day1).'<br>';
        echo $day2.': '.date('d.m.Y H:i:s',$day2).'<br>';
        echo $day3.': '.date('d.m.Y H:i:s',$day3).'<br><br><br>';

        echo 'And one day is always 24 hours * 60 minutes * 60 secondes = 
86400. So the difference between these three dates in timestamp should also 
be the same.But: <br>';

        echo 'day2-day1 = '.($day2-$day1).'<br>';
        echo 'day3-day2 = '.($day3-$day2).'<br>'; 

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux