[prev in list] [next in list] [prev in thread] [next in thread] 

List:       php-windows
Subject:    Re: [PHP-WIN] strange mktime
From:       "Michael Southworth" <mikesouthworth () gmail ! com>
Date:       2007-08-17 19:24:23
Message-ID: cbda40880708171224o48d4f4e9ie9627f02d46626d () mail ! gmail ! com
[Download RAW message or body]


Hello,
Perhaps this has something to do with the daylight savings time calculations
being handled by the underlying system, since the difference is 1 hour;
60*60 = 3600. This could be checked to make sure that the total time
difference from one year remains the same, or that the first 6 months has 1
hour less and the second 6 months have one hour more.
see
http://en.wikipedia.org/wiki/Daylight_saving_time_around_the_world
for details. Apparently 29.10 is a common daylight savings date, here in the
states the actual date can change.

-Michael

On 8/16/07, Peter Wechtersbach <peterw@agila.si> wrote:
>
> 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
>
>


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic