I'm still running 4.0.5 because that is what my web host is running.
Methinks there may be a problem here.

In the meantime I've tried storing the dates in the array in the original
format in lieu of the fully converted format.
I then reformat the original from the array as required for each page
display or time difference calculation.
This works fine, so I might stick with it.
In hindsight, it is probaly the way I should have gone in the first place as
you pointed out. That way I can play with the date, month and year any way I
want.

Thanks for you input.

John


"Niklas lampén" <[EMAIL PROTECTED]> wrote in message
000401c1636f$fd37d960$ba93c5c3@Niklas">news:000401c1636f$fd37d960$ba93c5c3@Niklas...
Great. :)

I've got PHP 4.0.6 on linux. You?

I think you should break the dates manually, it would be the most sure
way to do it.


Niklas


-----Original Message-----
From: John Clarke [mailto:[EMAIL PROTECTED]]
Sent: 2. marraskuuta 2001 9:11
To: [EMAIL PROTECTED]
Subject: Re: [PHP] year 2002 strtotime problem


Even more funny...

I cut and pasted your code and I got;

Wed Dec 12 2001
Sat Mar 1 2003
2001-12-12
2001-03-01

What version of Php and OS are you using??

John

"Niklas lampén" <[EMAIL PROTECTED]> wrote in message
000301c16369$6817a320$ba93c5c3@Niklas">news:000301c16369$6817a320$ba93c5c3@Niklas...
> Funny, I quickly tried this:
>
> <?
> $date1 = "12/12/2001";
> $date2 = "15/01/2002";
>
> $date1 = date("D M j Y", strtotime($date1));
> $date2 = date("D M j Y", strtotime($date2));
>
> print $date1."<br>";
> print $date2."<br>";
>
> print date("Y-m-d", strtotime($date1))."<br>";
> print date("Y-m-d", strtotime($date2))."<br>";
> ?>
>
> And the result was this:
> "
> Wed Dec 12 2001
> Sat Mar 1 2003
> 2001-12-12
> 2003-03-01
> "
>
>
> Niklas
>
>
> -----Original Message-----
> From: John Clarke [mailto:[EMAIL PROTECTED]]
> Sent: 2. marraskuuta 2001 8:17
> To: [EMAIL PROTECTED]
> Subject: [PHP] year 2002 strtotime problem
>
>
> 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
>
> $date1='12/12/2001'
> $date2='15/01/2002'
>
> I then use date("D M j Y", strtotime($date1);  and date("D M j Y",
> strtotime($date2)); 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'
> .......
> correct
>            echo 'date2= '.$dd2.' <br>';   //  displays '20010115
> ...........WRONG
>         }
>
>     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]
>



--
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]




-- 
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