I have this problem with Php 4.0.5 on both  Win ME and Linus boxes, where my
year 2002 dates are converted back to 2001 when formating with 'strtotime'.

First I post the following variables from an html page to a php page


I then use date("D M j Y", strtotime($date1);  and date("D M j Y",
to store them in an array for screen display.

As the users have the abilty to selected different dates I need to check
that 1 is before the other.
To do this I have a script timediff() that I pass the two dates to in the
above format.

All works fine until the year 2002 is selected. This is part of the
timediff() code with dispay statements and the result.

         function timediff($date1,$date2) {

           echo 'date1= '."$date1".' ';        // displays  'Wed December 12
2001'   ....... correct
           echo 'date2= '."$date2".' ';       //  displays   'Tue January 15
2002'       ...........correct, all fine so far

            $dd1=date("Ymd", strtotime($date1));
            $dd2=date("Ymd", strtotime($date2));

           echo 'date1= '.$dd1.'<br>';    // displays  '20011212'   .......
           echo 'date2= '.$dd2.' <br>';   //  displays '20010115

    It seem that by applying strtotime a 2nd time might cause this problem,
as the first application was fine.

    I have tested all possible combinations of strtotime but the year 2002
always goes back to 2001
Have also tried just 'strtotime($date1)' but same problem again.

Any help or comments would be greatly appreciated as I thought I had
finished a booking program any now find this!!

Thanks in anticipation

John Clarke

PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to