Re: strtotime time zone trouble

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux