Re: mktime()'s is_dst deprecated, but needed?

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

 



On Sun, 15 Oct 2006 13:22:02 +0200, Zora wrote:

> Hi all,
> 
> (first time I send an email here, so please be forgiving if something 
> doesn't follow expected rules.)
> 
> My web application allows users to enter time stamps (date and time) 
> given as local times. The time stamp is to be stored as UTC into the 
> data base.
> 
> Since we have summer and winter times (dst) there's an hour in the 
> autumn which exists twice in local time (it's 2:00 - 3:00 at the last 
> sunday in october here). Only the user knows which of these two hour is 
> intended to be stored into the data base, no program ever can decide 
> that by itself. Thus, the user has to add a character to the supplied 
> time stamp.
> 
> E.g.
> "<last sunday in october>, 02:30 A" is summer time (e.g. GMT +02:00),
> "<last sunday in october>, 02:30 B" is winter time (e.g. GMT +01:00).
> 
> My php function used the "is_dst" parameter of mktime() responding to 
> the user given "A" or "B".
> 
> How's that to solve in the future if "is_dst" doesn't exist any more?
> (For now, it still works but gives a log line everytime the function is 
> called - E_STRICT is set).
> 
> Thanks for your help,
> 
> Zora

Hi Zora,

How is the data stored in the database? By the timestamp of your
local time? In that case, you could just increment the timestamp by one
hour if someone sets summertime. You can also feed the mktime the
incremented hour, cause it will calculate the time correctly even with
values that are out of range (such as 25 hours, 75 minutes, etc).

Hope this helps,

Ivo

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