RE: [PHP] GMT strtotime() problem today!!

2003-04-01 Thread Ford, Mike [LSS]
> -Original Message-
> From: Stuart Cochrane [mailto:[EMAIL PROTECTED]
> Sent: 31 March 2003 15:45
> 
> I have a script that runs on over 250 Servers, all are running NT4.
> here is the script:
> 
> [php]
> function last_sunday() {
>   return gmdate("Y-m-d", strtotime("Last Sunday"));
> }
> echo "Last Sunday is returned as: ".last_sunday();
> [/php]
> 
> Some servers have 'automatically adjust clock for daylight saving 
> changes' switched on, some have this off - (im in the UK GMT +0).
> 
> With daylight saving on the above script returns: 2003-03-29
> With daylight saving off the above script returns: 2003-03-30
> 
> Im puzzled with this one - any ideas?

Well, since this is clearly a DST problem, I'd adopt the classic
DST-avoiding solution and specify a *time* that won't cause date-shifts if
it gets DST adjusted.  Also, as you're using gmdate, I think I'd specify
that in strtotime() too.  Taken together, this would give you something
like:

return gmdate("Y-m-d", strtotime("Last Sunday 12:00 GMT"));

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

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



[PHP] GMT strtotime() problem today!!

2003-03-31 Thread Stuart Cochrane
Im having big problems -

I have a script that runs on over 250 Servers, all are running NT4.
here is the script:

[php]
function last_sunday() {
return gmdate("Y-m-d", strtotime("Last Sunday"));
}
echo "Last Sunday is returned as: ".last_sunday();
[/php]

Some servers have 'automatically adjust clock for daylight saving 
changes' switched on, some have this off - (im in the UK GMT +0).

With daylight saving on the above script returns: 2003-03-29
With daylight saving off the above script returns: 2003-03-30

Im puzzled with this one - any ideas?
-Stuart

|-|
|- www.php-editors.com|
|- php programming contests   |
|- php tool reviews   |
|- php everything else|
|-|


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