Daylight Savings Time

Eric Chatonet eric.chatonet at sosmartsoftware.com
Tue Oct 28 13:57:01 EDT 2008


Bonsoir Ken,

First thanks for this information:
Viewed from Paris I did not know that daylight savings time was not  
one hour everywhere.
And you'll notice that my function just returns true or false :-)

So it's definitely a complex problem:
Would another approach, if it is possible, be to ask a 'database  
website' about this?

Le 28 oct. 08 à 18:51, Ken Ray a écrit :

>> This works well for me:
>>
>> function DaylightSavingsTimeIsActive
>>    local tCurDate,tRefDate
>>    -----
>>    put the short date into tCurDate
>>    convert tCurDate from short date to dateItems
>>    put tCurDate into tRefDate
>>    repeat with i = 2 to 3
>>      put 1 into item i of tRefDate
>>      -- January first
>>    end repeat
>>    convert tRefDate from dateItems to dateItems
>>    -- updates last item of dateItems value
>>    convert tCurDate from dateItems to seconds
>>    convert tRefDate from dateItems to seconds
>>    return (tRefDate - tCurDate) mod 86400 = 0
>> end DaylightSavingsTimeIsActive
>
> The only trouble with this is that there are some places in the  
> world where
> DST is not an hour, but is sometimes 30 minutes or 90 minutes;  
> also, there
> are parts of the US, for example, that do not observe DST even  
> though the
> rest of the US does - Arizona is an example, so I don't know how  
> this would
> run there.
>
> Unfortunately  there isn't a comprehensive way to know if DST is in  
> effect
> without knowing *where* the person is who's executing the code  
> (AFAICT).
>
> And of course it gets worse when you're asking for DST in effect for a
> specific date and place...
>
> Ken Ray

Best regards from Paris,
Eric Chatonet.
----------------------------------------------------------------
Plugins and tutorials for Revolution: http://www.sosmartsoftware.com/
Email: eric.chatonet at sosmartsoftware.com/
----------------------------------------------------------------





More information about the use-livecode mailing list