Link to home
Start Free TrialLog in
Avatar of astankovic
astankovic

asked on

detect if date/time is daylight savings time

Hi,

Given the following datetime string "2004-03-30 13:09:28" I need to detect if it is PST or PDT?

Dalight Savings time:
Starts: First Sunday in April at 2 am local time
Ends: Last Sunday in October at 2 am local time

What I need to do is append PST or PDT accordingly.

Thanks,
Alex
ASKER CERTIFIED SOLUTION
Avatar of wayside
wayside

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of wayside
wayside

More generally, you would extract the year out of your test date and use that when building the dates for startDST and endDST.
Avatar of astankovic

ASKER

Thanks!
Hello,

Those times you mention for DST are very specifically USA and Canada only - in fact it doesn't even really apply to all of the USA and Canada because Fort St. John, Charlie Lake, Taylor and Dawson Creek in British Columbia, Creston in the East Kootenays, and most of  Saskatchewan (except Denare Beach and Creighton) don't use daylight savings time at all.

Just to confuse things, the UK switches at one o'clock in the morning the last Sunday in March and two o'clock in the morning in October.  New Zealand did their switchover three weeks ago and Australia did their's the week after that.  Besides which, any region in the southern hemisphere that does daylight savings time does it at the opposite time of the year (Autumn here in New Zealand is in March/April)

Jerry