[REBOL] Daylight Savings function
From: ryan:christiansen:intellisol at: 18-Jun-2001 10:20
If you are in the United States in a location where Daylight Savings Time
is observed, here is a function to figure out whether or not you are in
Daylight Savings Time.
U.S._DaylightSavings?: func [
/local FirstSundayOfApril LastSundayOfOctober GMT GMT-based_U.S.
_DaylightSavingsBeginDate_CurrentYear GMT-based_U.S.
_DaylightSavingsEndDate_CurrentYear
][
FirstSundayOfApril: func [
year
][
make-begin-date: rejoin [{1-Apr-} year]
begin-date: make date! (make-begin-date)
either begin-date/weekday = 7 [
begin-date
][
until [
begin-date: begin-date + 1
begin-date/weekday = 7
]
begin-date
]
]
LastSundayOfOctober: func [
year
][
make-begin-date: rejoin [{31-Oct-} year]
begin-date: make date! (make-begin-date)
either begin-date/weekday = 7 [
begin-date
][
until [
begin-date: begin-date - 1
begin-date/weekday = 7
]
begin-date
]
]
GMT: now - now/zone
GMT-based_U.S._DaylightSavingsBeginDate_CurrentYear: FirstSundayOfApril
now/year
GMT-based_U.S._DaylightSavingsBeginDate_CurrentYear/time: 8:00:00
GMT-based_U.S._DaylightSavingsEndDate_CurrentYear: LastSundayOfOctober
now/year
GMT-based_U.S._DaylightSavingsEndDate_CurrentYear/time: 8:00:00
either all [(GMT > GMT-based_U.S.
_DaylightSavingsBeginDate_CurrentYear) (GMT < GMT-based_U.S.
_DaylightSavingsEndDate_CurrentYear)][
true
][
false
]
]
Ryan C. Christiansen
Web Developer
Intellisol International
4733 Amber Valley Parkway
Fargo, ND 58104
701-235-3390 ext. 6671
FAX: 701-235-9940
http://www.intellisol.com
Global Leader in People Performance Software
_____________________________________
Confidentiality Notice
This message may contain privileged and confidential information. If you
think, for any reason, that this message may have been addressed to you in
error, you must not disseminate, copy or take any action in reliance on it,
and we would ask you to notify us immediately by return email to
[ryan--christiansen--intellisol--com]