Daylight Savings Time
Ken Ray
kray at sonsothunder.com
Tue Oct 28 13:51:58 EDT 2008
> 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
Sons of Thunder Software, Inc.
Email: kray at sonsothunder.com
Web Site: http://www.sonsothunder.com/
More information about the use-livecode
mailing list