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

Posted by Marcus Bointon on 01/18/05 15:53

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.
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
--
Marcus Bointon
Synchromedia Limited: Putting you in the picture
marcus@synchromedia.co.uk | http://www.synchromedia.co.uk

 

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

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