You are here: Re: [PHP] strtotime time zone trouble « PHP « IT news, forums, messages
Re: [PHP] strtotime time zone trouble

Posted by M. Sokolewicz on 01/18/05 17:26

Marcus Bointon wrote:

>
> On 18 Jan 2005, at 10:53, Tom wrote:
>
>> PST = UTC - 8, therefore if you ask for strtotime in PST it will give
>> you now + 8. This is standard in most languages, you are just reading
>> the functionality back to front.
>> ie when you say strtotome('now PST'), what you are asking for is the
>> current local time (UTC in your instance) given an input date in PST
>
>
> OK, I see some logic in that - now how to work around it?
>
>> try
>> print date('Y-m-d H:i:s', strtotime('now') -0800)."\n";
>
>
> That definitely won't work; -0800 will be interpreted as an octal value,
> but it's not a legal value. If it was interpreted as a decimal value, it
> would subtract 800 minutes, which is no use to anyone.
actually, it would be 800 seconds (in octal, which is a non-existent
number (like saying A in decimal, or 2 in binary)).

Numeric offsets
> are supposed to work inside the strtotime string param, according to the
> docs.
>
> Much of the point of using zone names rather than fixed numeric offsets
> is that it allows for correct daylight savings calculations (assuming
> that locale data is correct on the server).
>
> Let me rephrase the question - how can I get the current time in a named
> time zone using strtotime and without using a numeric offset?
>
> Marcus

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация