Hi Januk,
Sat, 16 Nov 2002 23:47:10[GMT -0800] (2:47 AM EST here) you wrote:
(Please note that the above line was written by QINCLUDEing TZSelect
in place of EST (or EDT) in my reply template, but I had to change
TZSelect slightly.)
> On Saturday, November 16, 2002 at 11:39 GMT -0500, legend has it that
> Daniel Grunberg [DG] recited the incantation:
DG>> Is there a way I can fix my template, so that "EST" or "EDT" will be
DG>> given in the quote, in automatic accordance with my system time?
DG>> I have no idea of how to do it, but I thought that I might want to:
DG>> 1. Compute (or get) the original message's GMT hour.
DG>> 2. Compute the difference between the message's GMT hour and the
DG>> %OTIME hour.
DG>> 3. If the difference is 5 hours, "EST" will be used.
DG>> 4. If the difference is not 5 hours "EDT" will be used.
I forgot that for any given time zone, there are four (NOT two)
possible differences. (See below.)
> Yes, use the following to compute your timezone offset:
> =====[Begin TZOffset QT]=====
> %Calc='%-
> %SETPATTREGEXP="(?im-s)%-
> %-%-^Date\:.*?\s(\d{0,2})\:\d{0,2}\:\d{0,2}\s.*?([-+]\d{2})\d{2}"%-
> %REGEXPBLINDMATCH="%HEADERS"%-
> %OTIME="hh" - (%SUBPATT="1" - (%SUBPATT="2"))'%-
> =====[ End TZOffset QT]=====
> Then replace your EST with:
> =====[Begin TZSelect QT]=====
> %IF:"%QInclude='TZOffset'"="-5":"EST":"EDT"%-
> =====[ End TZSelect QT]=====
> The TZOffset QT seems to work on all sample messages here, but your
> mileage may vary.
Thank you for your answer, Januk.
Fortunately your message's time, 23:47 in the GMT-8 time zone is the day
before GMT's day. So your TZSelect yielded "DST" (the result that
would be yielded when TZOffset yields anything other than "-4" in the
problem I originally outlined), instead of the "EST" I expected.
I decided to test TZOffset, by QINCLUDEing TZOffset in my original
reply template instead of QINCLUDEing TZSelect there. Sure enough,
TZOffset yielded "-29". After some thought, I realized that for a few
hours each day, GMT's day is Eastern (Standard/Daylight) Time's
tomorrow. Since midnight is 00 hours, 1 AM is 01 hours, ..., TZOffset
yields a difference that's off by 24 hours, during the time when GMT
day is ahead of Eastern (Standard/Daylight) Time. As a result, there
are four (NOT two) possible differences that TZOffset can yield:
-5 during Eastern Standard Time (EST), when the message's GMT
day is the same as EST's equivalent day.
-29 during Eastern Standard Time (EST), when the message's GMT
day is EST's equivalent day's tomorrow.
-4 during Eastern Daylight Time (EDT), when the message's GMT
day is the same as EDT's equivalent day.
-28 for Eastern Daylight Time (EDT), when the message's GMT
day is EDT's equivalent day's tomorrow.
Fortunately for me, TZSelect was just an IF, THEN, ELSE statement in
disguise <grin>, so even an old hardware engineer could understand it
<again, a grin>. I was able to account for the four possibilities by
changing TZSelect to:
=====[Begin TZSelect QT]=====
%IF:"%QInclude='TZOffset'"="-5":"EST"%-
%IF:"%QInclude='TZOffset'"="-4":"EDT"%-
%IF:"%QInclude='TZOffset'"="-29":"EST"%-
%IF:"%QInclude='TZOffset'"="-28":"EDT"%-
=====[End TZSelect QT]=====
I tested everything with "today messages" and "tomorrow messages."
Then I set my clock back to August, and rechecked everything in
Eastern Daylight Time. Everything works.
Januk, thank you again for your help. Particularly, thank you for
making me think.
-- Dan
Using The Bat! v1.61
on Windows 95 4.0 Build 1111 B
--
Daniel A. Grunberg Kensington, Maryland, USA
homepage: www.nyx.net/~dgrunber/
________________________________________________________
Current version is 1.61 | "Using TBTECH" information:
http://www.silverstones.com/thebat/TBUDLInfo.html