########### # INFORMIX PROFESSIONAL SERVICES ####### # ## Denver, Colorado ###### # ### ================================================== ##### # #### File: %M% SCCS: %I% %P% #### # ##### Program: example ### # ###### Client: ## # ####### Author: Dennis J. Pimple # ########### Date: %G% %U% # THE PROBLEM: need to have a local DATETIME converted to Greenwich # Mean Time and vice versa # THE APPROACH: Based on TZ environment and information found in # date and tztab (see Unix manual entries) # Add or subtract hours as required. # tztab may be unique to HPUX, but as long as TZ is of # the same format, this code should work. # DISCLAIMER: You got this for free, and that's about what it's worth. # I tested a reasonable amount, but did not throughly try # every Date/TZ combination. You should test to your # satisfaction before putting into production. { # if you have a database with the Daylight Savings Time table in it, # (discussed more below), you can define a modular record like so: DATABASE dbname DEFINE m_dst RECORD LIKE dst.* } # since my (uncommented) code deals not with a database, I do thus: DEFINE m_dst RECORD tz CHAR(10), # timezone with not DST part, eg MST7 st_yy SMALLINT, # start year st_mm SMALLINT, # start month st_dd SMALLINT, # start day; DST actually begins the 1st # Sunday on or after this day st_hh SMALLINT, # start hour, usually 1 (1:00 AM) en_mm SMALLINT, # end month; month DST ends. # If en_mm < st_mm, then DST runs # through the end of the current year # and into en_mm of the next year en_dd SMALLINT, # end day; DST ends 1st Sunday on/after en_hh SMALLINT # end hour, usually 3 END RECORD MAIN DEFINE ldatetime DATETIME YEAR TO MINUTE DEFINE ltz CHAR(18) DEFINE gdatetime DATETIME YEAR TO MINUTE OPTIONS PROMPT LINE 10 CLEAR SCREEN # loop until the user hits INTERRUPT WHILE TRUE LET gdatetime = CURRENT PROMPT "Enter Datetime, or RETURN for ", gdatetime, ":" FOR ldatetime IF ldatetime IS NULL THEN LET ldatetime = gdatetime END IF # this is where you would have your SELECT from the Database LET ltz = fgl_getenv("TZ") PROMPT "Enter Timezone, or RETURN for ", ltz CLIPPED, ":" FOR ltz IF ltz IS NULL THEN LET ltz = fgl_getenv("TZ") END IF LET gdatetime = loc_to_gmt(ldatetime, ltz) DISPLAY ldatetime, " ", ltz CLIPPED, " is ", gdatetime, " GMT", "" AT 5,1 LET ldatetime = gmt_to_loc(gdatetime, ltz) DISPLAY gdatetime, " GMT is ", ldatetime, " ", ltz CLIPPED, "" AT 6,1 END WHILE END MAIN #---------------------------------------------------------------------# FUNCTION loc_to_gmt(ldatetime, ltz) # Arguments: local DATETIME, char of the timezone it came from # Purpose: Convert the passed DATETIME to GMT DATETIME # Returns: DATETIME with GMT #---------------------------------------------------------------------# # comments below will use my local TZ, MST7MDT as example DEFINE ldatetime DATETIME YEAR TO SECOND DEFINE ltz CHAR(18) # MST7MDT DEFINE gdatetime DATETIME YEAR TO SECOND DEFINE ftz CHAR(10) # formatted tz sans DST entry: MST7 DEFINE htm INTERVAL HOUR TO MINUTE DEFINE fdst CHAR(10) # DST entry: MDT or NULL if no DST LET gdatetime = NULL # walk through the ltz sent and break it into ftz, offset (htm) and fdst CALL parse_tz(ltz) RETURNING ftz, htm, fdst IF htm IS NOT NULL THEN # do we need to decrement an hour for DST? # we do if fdst (the DST part of ltz) is not null # and if we're not in most of Indiana (EST5CDT), since there # they go from EST5 (5 hours off GMT) # to CDT (also 5 hours off GMT), so they don't change. IF LENGTH(fdst) > 0 AND ltz != "EST5CDT" THEN IF daylight_savings(ldatetime, ftz) THEN # since during DST we "spring ahead" an hour, # we need to "fall back" the time we're trying to calculate LET ldatetime = ldatetime - 1 UNITS HOUR END IF END IF # Calculate GMT LET gdatetime = ldatetime + htm END IF # htm IS NOT NULL RETURN gdatetime END FUNCTION # loc_to_gmt(ldatetime, ltz) #---------------------------------------------------------------------# FUNCTION gmt_to_loc(gdatetime, ltz) # Arguments: gmt DATETIME, char of the timezone we want to convert to # Purpose: Convert the passed GMT DATETIME to a local DATETIME # Returns: local DATETIME #---------------------------------------------------------------------# # comments below will use my local TZ, MST7MDT as example DEFINE gdatetime DATETIME YEAR TO SECOND DEFINE ltz CHAR(18) # MST7MDT DEFINE ldatetime DATETIME YEAR TO SECOND DEFINE ftz CHAR(10) # formatted tz sans DST entry: MST7 DEFINE htm INTERVAL HOUR TO MINUTE DEFINE fdst CHAR(10) # DST entry: MDT or NULL if no DST LET ldatetime = NULL # walk through the ltz sent and break it into ftz, offset (htm) and fdst CALL parse_tz(ltz) RETURNING ftz, htm, fdst IF htm IS NOT NULL THEN # Calculate local time LET ldatetime = gdatetime - htm # do we need to increment an hour for DST? # we do if fdst (the DST part of ltz) is not null # and if we're not in most of Indiana (EST5CDT), since there # they go from EST5 (5 hours off GMT) # to CDT (also 5 hours off GMT), so they don't change IF LENGTH(fdst) > 0 AND ltz != "EST5CDT" THEN IF daylight_savings(ldatetime, ftz) THEN # we are in DST, so we need to "Spring Ahead" an hour LET ldatetime = ldatetime + 1 UNITS HOUR END IF END IF END IF # htm IS NOT NULL RETURN ldatetime END FUNCTION # gmt_to_loc(gdatetime, ltz) #---------------------------------------------------------------------# FUNCTION parse_tz(ltz) # Arguments: timzone # Purpose: break tz (MST7MDT), # into the local timezone (MST7), the offset (" 07:00"), # and the DST tz if any (MDT) # Returns: the three described above #---------------------------------------------------------------------# # comments below will use my local TZ, MST7MDT as example DEFINE ltz CHAR(18) # MST7MDT # DEFINE lth SMALLINT # LENGTH DEFINE ct SMALLINT # FOR counter DEFINE colon SMALLINT # TRUE if we find ":" in the string DEFINE minus SMALLINT # TRUE if we find "-" in the string # DEFINE ftz CHAR(10) # formatted tz sans DST entry: MST7 DEFINE coffset CHAR(6) # char of offset -hh:mm DEFINE htm INTERVAL HOUR TO MINUTE DEFINE fdst CHAR(10) # DST entry: MDT or NULL if no DST LET ftz = NULL LET coffset = NULL LET htm = NULL LET fdst = NULL LET lth = LENGTH(ltz) IF lth > 0 THEN LET colon = FALSE LET minus = FALSE FOR ct = 1 TO lth IF ltz[ct] MATCHES "[0123456789]" OR ltz[ct] = "-" OR ltz[ct] = ":" THEN # this is part of the numeric offset: MST7MDT # ^ # it is of the form -hh:mm with "-" and ":mm" optional # track whether or not we find ":" and/or "-" IF ltz[ct] = ":" THEN LET colon = TRUE END IF IF ltz[ct] = "-" THEN LET minus = TRUE ELSE # store all of the offset except the - sign LET coffset = coffset CLIPPED, ltz[ct] END IF # this is also part of ftz LET ftz = ftz CLIPPED, ltz[ct] ELSE # this is part of ftz if we haven't gotten to offset yet, # else it's part of fdst IF coffset IS NULL THEN LET ftz = ftz CLIPPED, ltz[ct] ELSE LET fdst = fdst CLIPPED, ltz[ct] END IF END IF END FOR # ct = 1 TO lth IF coffset IS NOT NULL THEN # format coffset now so that it will go into a INTERVAL # right now in my example it is "7 " IF NOT colon THEN # add minutes if not in place LET coffset = coffset CLIPPED, ":00" # "7:00 " END IF IF LENGTH(coffset) < 5 THEN # need to add a "0" to the front LET coffset = "0", coffset CLIPPED # "07:00" END IF IF minus THEN LET coffset = "-", coffset CLIPPED ELSE LET coffset = " ", coffset CLIPPED # " 07:00" END IF # put the CHAR into an INTERVAL LET htm = coffset END IF # coffset IS NOT NULL END IF # lth > 0 RETURN ftz, htm, fdst END FUNCTION # parse_tz(ltz) #---------------------------------------------------------------------# FUNCTION daylight_savings(ldatetime, ftz) # Arguments: DATETIME, char of the timezone # Purpose: See if the passed DATETIME is within Daylight Savings Time # range for the passed Timezone # Returns: TRUE if in DST, FALSE otherwise #---------------------------------------------------------------------# # comments below will use my local TZ, MST7MDT as example DEFINE ldatetime DATETIME YEAR TO HOUR DEFINE ftz CHAR(10) # formatted tz sans DST entry: MST7 DEFINE cdatetime CHAR(13) # yyyy-mm-dd hh DEFINE cyy CHAR(4) # yyyy DEFINE yy SMALLINT DEFINE dstok SMALLINT # TRUE if ldatetime w/in DST date range DEFINE ldate DATE DEFINE dstdatetime DATETIME YEAR TO HOUR # DST datetime DEFINE stddatetime DATETIME YEAR TO HOUR # Standard datetime LET dstok = FALSE # put the datetime into a CHAR LET cdatetime = ldatetime # get the year LET cyy = cdatetime[1,4] LET yy = cyy # get the dst row that matches timezone and has max(year) <= yy CALL sel_dst(ftz, yy) # m_dst.* is filled in for the relavent dst row. # if null, it means DST does NOT apply IF m_dst.tz IS NOT NULL THEN # determine when DST started for the year of the day in question # yy has the year already LET ldate = MDY(m_dst.st_mm, m_dst.st_dd, yy) # get the next Sunday WHILE WEEKDAY(ldate) != 0 LET ldate = ldate + 1 END WHILE # WEEKDAY(ldate) != 0 LET cdatetime = ldate USING "yyyy-mm-dd", " ", m_dst.st_hh USING "&&" LET dstdatetime = EXTEND(cdatetime, YEAR TO HOUR) # determine when DST ended # if the m_dst.en_mm < m_dst.st_mm, we're south of the equator # and DST runs through the end of the year IF m_dst.en_mm < m_dst.st_mm THEN LET yy = yy + 1 LET cdatetime = yy USING "&&&&", "-01-01 00" ELSE LET ldate = MDY(m_dst.en_mm, m_dst.en_dd, yy) # get the next Sunday WHILE WEEKDAY(ldate) != 0 LET ldate = ldate + 1 END WHILE # WEEKDAY(ldate) != 0 LET cdatetime = ldate USING "yyyy-mm-dd", " ", m_dst.en_hh USING "&&" END IF LET stddatetime = EXTEND(cdatetime, YEAR TO HOUR) IF ldatetime >= dstdatetime AND ldatetime < stddatetime THEN # our datetime is within the DST epoch LET dstok = TRUE END IF END IF RETURN dstok END FUNCTION # daylight_savings(ldatetime, ftz) #---------------------------------------------------------------------# FUNCTION sel_dst(ftz, yy) # Arguments: TZ & year we're interested # e.g. MST7 1995 # Purpose: Get the Daylight Savings Time row for given TZ & year # This can be done as a database SELECT or hard_coded; # I'll show both below. # The values of m_dst were derived from HPUX's tztab # Returns: NA; m_dst.* is filled in #---------------------------------------------------------------------# DEFINE ftz CHAR(10) # formatted tz sans DST entry: MST7 DEFINE yy SMALLINT LET m_dst.tz = ftz CASE WHEN ftz = "MEZ-1" OR ftz = "MET-1" OR ftz = "PWT0" IF yy >= 1983 THEN LET m_dst.st_yy = 1983 LET m_dst.st_mm = 3 LET m_dst.st_dd = 25 LET m_dst.st_hh = 3 LET m_dst.en_mm = 9 LET m_dst.en_dd = 24 LET m_dst.en_hh = 2 ELSE INITIALIZE m_dst.* TO NULL END IF WHEN ftz = "GMT0" OR ftz = "WET0" CASE WHEN yy >= 1991 AND ftz != "WET0" LET m_dst.st_yy = 1991 LET m_dst.st_mm = 3 LET m_dst.st_dd = 25 LET m_dst.st_hh = 3 LET m_dst.en_mm = 10 LET m_dst.en_dd = 23 LET m_dst.en_hh = 1 WHEN yy >= 1986 LET m_dst.st_yy = 1986 LET m_dst.st_mm = 3 LET m_dst.st_dd = 23 LET m_dst.st_hh = 3 LET m_dst.en_mm = 10 LET m_dst.en_dd = 23 LET m_dst.en_hh = 1 WHEN yy >= 1985 LET m_dst.st_yy = 1985 LET m_dst.st_mm = 3 LET m_dst.st_dd = 23 LET m_dst.st_hh = 3 LET m_dst.en_mm = 10 LET m_dst.en_dd = 25 LET m_dst.en_hh = 1 WHEN yy >= 1983 LET m_dst.st_yy = 1983 LET m_dst.st_mm = 3 LET m_dst.st_dd = 25 LET m_dst.st_hh = 3 LET m_dst.en_mm = 10 LET m_dst.en_dd = 25 LET m_dst.en_hh = 1 OTHERWISE INITIALIZE m_dst.* TO NULL END CASE # yy WHEN ftz = "PST8" OR ftz = "EST5" OR ftz = "CST6" OR ftz = "MST7" OR ftz = "AST4" OR ftz = "NST3:30" OR ftz = "AST10" OR ftz = "YST9" CASE WHEN yy >= 1987 AND ftz != "AST10" AND ftz != "YST9" LET m_dst.st_yy = 1987 LET m_dst.st_mm = 4 LET m_dst.st_dd = 1 LET m_dst.st_hh = 3 LET m_dst.en_mm = 10 LET m_dst.en_dd = 25 LET m_dst.en_hh = 1 WHEN yy >= 1976 LET m_dst.st_yy = 1976 LET m_dst.st_mm = 4 LET m_dst.st_dd = 24 LET m_dst.st_hh = 3 LET m_dst.en_mm = 10 LET m_dst.en_dd = 25 LET m_dst.en_hh = 1 WHEN yy >= 1975 LET m_dst.st_yy = 1975 LET m_dst.st_mm = 2 LET m_dst.st_dd = 22 LET m_dst.st_hh = 3 LET m_dst.en_mm = 10 LET m_dst.en_dd = 25 LET m_dst.en_hh = 1 WHEN yy >= 1974 LET m_dst.st_yy = 1974 LET m_dst.st_mm = 1 LET m_dst.st_dd = 6 LET m_dst.st_hh = 3 LET m_dst.en_mm = 11 LET m_dst.en_dd = 24 LET m_dst.en_hh = 1 WHEN yy >= 1970 LET m_dst.st_yy = 1970 LET m_dst.st_mm = 4 LET m_dst.st_dd = 24 LET m_dst.st_hh = 3 LET m_dst.en_mm = 10 LET m_dst.en_dd = 25 LET m_dst.en_hh = 1 OTHERWISE INITIALIZE m_dst.* TO NULL END CASE # yy WHEN ftz = "SAST-2" IF yy >= 1985 THEN LET m_dst.st_yy = 1985 LET m_dst.st_mm = 10 LET m_dst.st_dd = 25 LET m_dst.st_hh = 3 LET m_dst.en_mm = 3 LET m_dst.en_dd = 1 LET m_dst.en_hh = 1 ELSE INITIALIZE m_dst.* TO NULL END IF WHEN ftz = "CST-9:30" CASE WHEN yy >= 1972 LET m_dst.st_yy = 1972 LET m_dst.st_mm = 10 LET m_dst.st_dd = 25 LET m_dst.st_hh = 3 LET m_dst.en_mm = 2 LET m_dst.en_dd = 27 LET m_dst.en_hh = 1 WHEN yy >= 1971 LET m_dst.st_yy = 1971 LET m_dst.st_mm = 10 LET m_dst.st_dd = 25 LET m_dst.st_hh = 3 LET m_dst.en_mm = 3 LET m_dst.en_dd = 1 LET m_dst.en_hh = 1 OTHERWISE INITIALIZE m_dst.* TO NULL END CASE # yy WHEN ftz = "EST-10" CASE WHEN yy >= 1971 LET m_dst.st_yy = 1971 LET m_dst.st_mm = 10 LET m_dst.st_dd = 25 LET m_dst.st_hh = 3 LET m_dst.en_mm = 2 LET m_dst.en_dd = 27 LET m_dst.en_hh = 1 WHEN yy >= 1972 LET m_dst.st_yy = 1972 LET m_dst.st_mm = 10 LET m_dst.st_dd = 25 LET m_dst.st_hh = 3 LET m_dst.en_mm = 3 LET m_dst.en_dd = 1 LET m_dst.en_hh = 1 WHEN yy >= 1985 LET m_dst.st_yy = 1985 LET m_dst.st_mm = 10 LET m_dst.st_dd = 25 LET m_dst.st_hh = 3 LET m_dst.en_mm = 3 LET m_dst.en_dd = 15 LET m_dst.en_hh = 1 WHEN yy >= 1986 LET m_dst.st_yy = 1986 LET m_dst.st_mm = 10 LET m_dst.st_dd = 25 LET m_dst.st_hh = 3 LET m_dst.en_mm = 3 LET m_dst.en_dd = 1 LET m_dst.en_hh = 1 OTHERWISE INITIALIZE m_dst.* TO NULL END CASE # yy WHEN ftz = "NZST-12" CASE WHEN yy > 1999 -- tztab shows no DST for this tz after 1999 INITIALIZE m_dst.* TO NULL WHEN yy >= 1990 LET m_dst.st_yy = 1990 LET m_dst.st_mm = 10 LET m_dst.st_dd = 1 LET m_dst.st_hh = 3 LET m_dst.en_mm = 3 LET m_dst.en_dd = 15 LET m_dst.en_hh = 1 WHEN yy >= 1989 LET m_dst.st_yy = 1989 LET m_dst.st_mm = 10 LET m_dst.st_dd = 8 LET m_dst.st_hh = 3 LET m_dst.en_mm = 3 LET m_dst.en_dd = 15 LET m_dst.en_hh = 1 WHEN yy >= 1985 LET m_dst.st_yy = 1985 LET m_dst.st_mm = 10 LET m_dst.st_dd = 25 LET m_dst.st_hh = 3 LET m_dst.en_mm = 3 LET m_dst.en_dd = 1 LET m_dst.en_hh = 1 OTHERWISE INITIALIZE m_dst.* TO NULL END CASE # yy WHEN ftz = "EST6" IF yy >= 1970 THEN LET m_dst.st_yy = 1970 LET m_dst.st_mm = 1 LET m_dst.st_dd = 1 LET m_dst.st_hh = 0 LET m_dst.en_mm = 12 LET m_dst.en_dd = 31 LET m_dst.en_hh = 23 ELSE INITIALIZE m_dst.* TO NULL END IF OTHERWISE INITIALIZE m_dst.* TO NULL END CASE # ftz END FUNCTION # sel_dst(ftz, yy) { This is the DATABASE way to do the same thing. here's the SQL code to create the table and load it: ------------------------ CUT HERE FOR dst.sql -------------------------- CREATE TABLE dst ( tz CHAR(10), -- timezone with not DST part, eg MST7 st_yy SMALLINT, -- start year st_mm SMALLINT, -- start month st_dd SMALLINT, -- start day; DST actually begins the 1st -- Sunday on or after this day st_hh SMALLINT, -- start hour, usually 1 (1:00 AM) en_mm SMALLINT, -- end month; month DST ends. -- If en_mm < st_mm, then DST runs -- through the end of the current year -- and into en_mm of the next year en_dd SMALLINT, -- end day; DST ends 1st Sunday on/after en_hh SMALLINT -- end hour, usually 3 ); CREATE UNIQUE INDEX dst_01 ON dst(tz,st_yy); CREATE INDEX dst_02 ON dst(st_yy); -- comments above each block of INSERT statements show the -- tztab entries from which they were derived -- Mitteleuropaeische Zeit, Mitteleuropaeische Sommerzeit -- MEZ-1MESZ -- 0 3 25-31 3 1983-2038 0 MESZ-2 -- 0 2 24-30 9 1983-2038 0 MEZ-1 INSERT INTO dst VALUES ("MEZ-1",1983,3,25,3,9,24,2); -- Middle European Time, Middle European Time Daylight Savings Time -- MET-1METDST -- 0 3 25-31 3 1983-2038 0 METDST-2 -- 0 2 24-30 9 1983-2038 0 MET-1 -- same as MEZ-1 except tz INSERT INTO dst VALUES ("MET-1",1983,3,25,3,9,24,2); -- Greenwich Mean Time, British Summer Time -- GMT0BST -- 0 3 25-31 3 1983-1984 0 BST-1 -- 0 3 23-29 3 1985-1990 0 BST-1 -- 0 3 25-31 3 1991-2038 0 BST-1 -- 0 1 25-31 10 1983-1985 0 GMT0 -- 0 1 23-29 10 1986-2038 0 GMT0 INSERT INTO dst VALUES ("GMT0",1983,3,25,3,10,25,1); INSERT INTO dst VALUES ("GMT0",1985,3,23,3,10,25,1); INSERT INTO dst VALUES ("GMT0",1986,3,23,3,10,23,1); INSERT INTO dst VALUES ("GMT0",1991,3,25,3,10,23,1); -- Pacific Standard Time, Pacific Daylight Time -- PST8PDT -- 0 3 24-30 4 1970-1973 0 PDT7 -- 0 3 6 1 1974 0-6 PDT7 -- 0 3 22-28 2 1975 0 PDT7 -- 0 3 24-30 4 1976-1986 0 PDT7 -- 0 3 1-7 4 1987-2038 0 PDT7 -- 0 1 25-31 10 1970-1973 0 PST8 -- 0 1 24-30 11 1974 0 PST8 -- 0 1 25-31 10 1975-2038 0 PST8 INSERT INTO dst VALUES ("PST8",1970,4,24,3,10,25,1); INSERT INTO dst VALUES ("PST8",1974,1,6,3,11,24,1); INSERT INTO dst VALUES ("PST8",1975,2,22,3,10,25,1); INSERT INTO dst VALUES ("PST8",1976,4,24,3,10,25,1); INSERT INTO dst VALUES ("PST8",1987,4,1,3,10,25,1); -- Eastern Standard Time, Eastern Daylight Time -- EST5EDT -- 0 3 24-30 4 1970-1973 0 EDT4 -- 0 3 6 1 1974 0-6 EDT4 -- 0 3 22-28 2 1975 0 EDT4 -- 0 3 24-30 4 1976-1986 0 EDT4 -- 0 3 1-7 4 1987-2038 0 EDT4 -- 0 1 25-31 10 1970-1973 0 EST5 -- 0 1 24-30 11 1974 0 EST5 -- 0 1 25-31 10 1975-2038 0 EST5 -- same as PST8 except tz INSERT INTO dst VALUES ("EST5",1970,4,24,3,10,25,1); INSERT INTO dst VALUES ("EST5",1974,1,6,3,11,24,1); INSERT INTO dst VALUES ("EST5",1975,2,22,3,10,25,1); INSERT INTO dst VALUES ("EST5",1976,4,24,3,10,25,1); INSERT INTO dst VALUES ("EST5",1987,4,1,3,10,25,1); -- Central Standard Time, Central Daylight Time -- CST6CDT -- 0 3 24-30 4 1970-1973 0 CDT5 -- 0 3 6 1 1974 0-6 CDT5 -- 0 3 22-28 2 1975 0 CDT5 -- 0 3 24-30 4 1976-1986 0 CDT5 -- 0 3 1-7 4 1987-2038 0 CDT5 -- 0 1 25-31 10 1970-1973 0 CST6 -- 0 1 24-30 11 1974 0 CST6 -- 0 1 25-31 10 1975-2038 0 CST6 -- same as PST8 except tz INSERT INTO dst VALUES ("CST6",1970,4,24,3,10,25,1); INSERT INTO dst VALUES ("CST6",1974,1,6,3,11,24,1); INSERT INTO dst VALUES ("CST6",1975,2,22,3,10,25,1); INSERT INTO dst VALUES ("CST6",1976,4,24,3,10,25,1); INSERT INTO dst VALUES ("CST6",1987,4,1,3,10,25,1); -- Mountain Standard Time, Mountain Daylight Time -- MST7MDT -- 0 3 24-30 4 1970-1973 0 MDT6 -- 0 3 6 1 1974 0-6 MDT6 -- 0 3 22-28 2 1975 0 MDT6 -- 0 3 24-30 4 1976-1986 0 MDT6 -- 0 3 1-7 4 1987-2038 0 MDT6 -- 0 1 25-31 10 1970-1973 0 MST7 -- 0 1 24-30 11 1974 0 MST7 -- 0 1 25-31 10 1975-2038 0 MST7 -- same as PST8 except tz INSERT INTO dst VALUES ("MST7",1970,4,24,3,10,25,1); INSERT INTO dst VALUES ("MST7",1974,1,6,3,11,24,1); INSERT INTO dst VALUES ("MST7",1975,2,22,3,10,25,1); INSERT INTO dst VALUES ("MST7",1976,4,24,3,10,25,1); INSERT INTO dst VALUES ("MST7",1987,4,1,3,10,25,1); -- Atlantic Standard Time, Atlantic Daylight Time -- AST4ADT -- 0 3 24-30 4 1970-1973 0 ADT3 -- 0 3 6 1 1974 0-6 ADT3 -- 0 3 22-28 2 1975 0 ADT3 -- 0 3 24-30 4 1976-1986 0 ADT3 -- 0 3 1-7 4 1987-2038 0 ADT3 -- 0 1 25-31 10 1970-1973 0 AST4 -- 0 1 24-30 11 1974 0 AST4 -- 0 1 25-31 10 1975-2038 0 AST4 -- same as PST8 except tz INSERT INTO dst VALUES ("AST4",1970,4,24,3,10,25,1); INSERT INTO dst VALUES ("AST4",1974,1,6,3,11,24,1); INSERT INTO dst VALUES ("AST4",1975,2,22,3,10,25,1); INSERT INTO dst VALUES ("AST4",1976,4,24,3,10,25,1); INSERT INTO dst VALUES ("AST4",1987,4,1,3,10,25,1); -- Newfoundland Standard Time, Newfoundland Daylight Time -- NST3:30NDT -- 0 3 24-30 4 1970-1973 0 NDT2:30 -- 0 3 6 1 1974 0-6 NDT2:30 -- 0 3 22-28 2 1975 0 NDT2:30 -- 0 3 24-30 4 1976-1986 0 NDT2:30 -- 0 3 1-7 4 1987-2038 0 NDT2:30 -- 0 1 25-31 10 1970-1973 0 NST3:30 -- 0 1 24-30 11 1974 0 NST3:30 -- 0 1 25-31 10 1975-2038 0 NST3:30 -- same as PST8 except tz INSERT INTO dst VALUES ("NST3:30",1970,4,24,3,10,25,1); INSERT INTO dst VALUES ("NST3:30",1974,1,6,3,11,24,1); INSERT INTO dst VALUES ("NST3:30",1975,2,22,3,10,25,1); INSERT INTO dst VALUES ("NST3:30",1976,4,24,3,10,25,1); INSERT INTO dst VALUES ("NST3:30",1987,4,1,3,10,25,1); -- Eastern Standard Time, Central Daylight Time (US: Indiana) -- EST5CDT -- 0 3 24-30 4 1970-1973 0 CDT5 -- 0 3 6 1 1974 0-6 CDT5 -- 0 3 22-28 2 1975 0 CDT5 -- 0 3 24-30 4 1976-1986 0 CDT5 -- 0 3 1-7 4 1987-2038 0 CDT5 -- 0 1 25-31 10 1970-1973 0 EST5 -- 0 1 24-30 11 1974 0 EST5 -- 0 1 25-31 10 1975-2038 0 EST5 -- NAR, all rows match Eastern Standard Time, Eastern Daylight Time -- and besides that, Indiana will be handled as an exception in the -- 4gl code because they don't change their clocks since they use -- Eastern Standard Time (5 hours added to GMT), -- and Central Daylight Time (also 5 hours added to GMT). -- Aleutian Standard Time, Aleutian Daylight Time -- AST10ADT -- 0 3 24-30 4 1970-1973 0 ADT9 -- 0 3 6 1 1974 0-6 ADT9 -- 0 3 22-28 2 1975 0 ADT9 -- 0 3 24-30 4 1976-2038 0 ADT9 -- 0 1 25-31 10 1970-1973 0 AST10 -- 0 1 24-30 11 1974 0 AST10 -- 0 1 25-31 10 1975-2038 0 AST10 -- same as PST8 except tz and no 1987 conversion INSERT INTO dst VALUES ("AST10",1970,4,24,3,10,25,1); INSERT INTO dst VALUES ("AST10",1974,1,6,3,11,24,1); INSERT INTO dst VALUES ("AST10",1975,2,22,3,10,25,1); INSERT INTO dst VALUES ("AST10",1976,4,24,3,10,25,1); -- Yukon Standard Time, Yukon Daylight Time -- YST9YDT -- 0 3 24-30 4 1970-1973 0 YDT8 -- 0 3 6 1 1974 0-6 YDT8 -- 0 3 22-28 2 1975 0 YDT8 -- 0 3 24-30 4 1976-2038 0 YDT8 -- 0 1 25-31 10 1970-1973 0 YST9 -- 0 1 24-30 11 1974 0 YST9 -- 0 1 25-31 10 1975-2038 0 YST9 -- same as AST10 except tz INSERT INTO dst VALUES ("YST9",1970,4,24,3,10,25,1); INSERT INTO dst VALUES ("YST9",1974,1,6,3,11,24,1); INSERT INTO dst VALUES ("YST9",1975,2,22,3,10,25,1); INSERT INTO dst VALUES ("YST9",1976,4,24,3,10,25,1); -- Western European Time, Western European Time Daylight Savings Time -- WET0WETDST -- 0 3 25-31 3 1983-1984 0 WETDST-1 -- 0 3 23-29 3 1985-2038 0 WETDST-1 -- 0 1 25-31 10 1983-1985 0 WET0 -- 0 1 23-29 10 1986-2038 0 WET0 -- same as GMT0 except tz and not 1991 change INSERT INTO dst VALUES ("WET0",1983,3,25,3,10,25,1); INSERT INTO dst VALUES ("WET0",1985,3,23,3,10,25,1); INSERT INTO dst VALUES ("WET0",1986,3,23,3,10,23,1); -- Portuguese Winter Time, Portuguese Summer Time -- PWT0PST -- 0 3 25-31 3 1983-2038 0 PST-1 -- 0 2 24-30 9 1983-2038 0 PWT0 -- same as MEZ-1 except tz INSERT INTO dst VALUES ("PWT0",1983,3,25,3,9,24,2); -- South Africa Stardard Time, South Africa Daylight Time -- SAST-2SADT -- 0 3 25-31 10 1985-2038 0 SADT-3 -- 0 1 1-7 3 1985-2038 0 SAST-2 INSERT INTO dst VALUES ("SAST-2",1985,10,25,3,3,1,1); -- Australian Central Standard Time, Australian Central Daylight Time -- CST-9:30CDT -- 0 3 25-31 10 1971-2038 0 CDT-10:30 -- 0 1 27 2 1972 0-6 CST-9:30 -- 0 1 1-7 3 1973-2038 0 CST-9:30 INSERT INTO dst VALUES ("CST-9:30",1971,10,25,3,2,27,1); INSERT INTO dst VALUES ("CST-9:30",1972,10,25,3,3,1,1); -- Australian Eastern Standard Time, Australian Eastern Daylight Time -- EST-10EDT -- 0 3 25-31 10 1971-2038 0 EDT-11 -- 0 1 27 2 1972 0-6 EST-10 -- 0 1 1-7 3 1973-1985 0 EST-10 -- 0 1 15-21 3 1986 0 EST-10 -- 0 1 1-7 3 1987-2038 0 EST-10 INSERT INTO dst VALUES ("EST-10",1971,10,25,3,2,27,1); INSERT INTO dst VALUES ("EST-10",1972,10,25,3,3,1,1); INSERT INTO dst VALUES ("EST-10",1985,10,25,3,3,15,1); INSERT INTO dst VALUES ("EST-10",1986,10,25,3,3,1,1); -- New Zealand Stardard Time, New Zealand Daylight Time -- NZST-12NZDT -- 0 3 25-31 10 1985-1988 0 NZDT-13 -- 0 3 8 10 1989 0-6 NZDT-13 -- 0 3 1-7 10 1990-1999 0 NZDT-13 -- 0 1 1-7 3 1985-1989 0 NZST-12 -- 0 1 15-21 3 1990-1999 0 NZST-12 INSERT INTO dst VALUES ("NZST-12",1985,10,25,3,3,1,1); INSERT INTO dst VALUES ("NZST-12",1989,10,8,3,3,15,1); INSERT INTO dst VALUES ("NZST-12",1990,10,1,3,3,15,1); -- No entry after 1999? I'm assuming it means no DST, -- so for purposes of how I use this table create a row in which -- DST starts and ends at the same time INSERT INTO dst VALUES ("NZST-12",2000,10,1,3,10,1,3); -- The timezones named above should be used in preference to those below except -- for dates prior to 1987 for Tasmania. US and Canada use the same rules so -- the simpler timezone strings above will work for both countries. -- Australian Eastern Standard Time, Australian Eastern Daylight Time (Tasmania) -- (same as EST-10EDT for 1987 - 2038) -- EST-10EDT#Tasmania -- 0 3 25-31 10 1971-2038 0 EDT#Tasmania-11 -- 0 1 27 2 1972 0-6 EST-10 -- 0 1 1-7 3 1973-2038 0 EST-10 -- Without adding a dst-tz in the table, which I am hesitant to do, -- I can't track the subtle pre-1987 tz problem with Tasmania. -- This is left as a exercise if you REALLY need accuate Tasmania dates -- between 1975 and 1987, which seems to be the affect epoch -- Pacific Standard Time, Pacific Daylight Time (Canada) -- PST8PDT#Canada -- 0 3 24-30 4 1970-1973 0 PDT#Canada7 -- 0 3 6 1 1974 0-6 PDT#Canada7 -- 0 3 22-28 2 1975 0 PDT#Canada7 -- 0 3 24-30 4 1976-1986 0 PDT#Canada7 -- 0 3 1-7 4 1987-2038 0 PDT#Canada7 -- 0 1 25-31 10 1970-1973 0 PST8 -- 0 1 24-30 11 1974 0 PST8 -- 0 1 25-31 10 1975-2038 0 PST8 -- NAR; all rows match Pacific Standard Time, Pacific Daylight Time -- Mountain Standard Time, Mountain Daylight Time (Canada) -- MST7MDT#Canada -- 0 3 24-30 4 1970-1973 0 MDT#Canada6 -- 0 3 6 1 1974 0-6 MDT#Canada6 -- 0 3 22-28 2 1975 0 MDT#Canada6 -- 0 3 24-30 4 1976-1986 0 MDT#Canada6 -- 0 3 1-7 4 1987-2038 0 MDT#Canada6 -- 0 1 25-31 10 1970-1973 0 MST7 -- 0 1 24-30 11 1974 0 MST7 -- 0 1 25-31 10 1975-2038 0 MST7 -- NAR, all rows match Mountain Standard Time, Mountain Daylight Time -- Central Standard Time, Central Daylight Time (Canada) -- CST6CDT#Canada -- 0 3 24-30 4 1970-1973 0 CDT#Canada5 -- 0 3 6 1 1974 0-6 CDT#Canada5 -- 0 3 22-28 2 1975 0 CDT#Canada5 -- 0 3 24-30 4 1976-1986 0 CDT#Canada5 -- 0 3 1-7 4 1987-2038 0 CDT#Canada5 -- 0 1 25-31 10 1970-1973 0 CST6 -- 0 1 24-30 11 1974 0 CST6 -- 0 1 25-31 10 1975-2038 0 CST6 -- NAR, all rows match Central Standard Time, Central Daylight Time -- Eastern Standard Time, Eastern Daylight Time (Canada) -- EST5EDT#Canada -- 0 3 24-30 4 1970-1973 0 EDT#Canada4 -- 0 3 6 1 1974 0-6 EDT#Canada4 -- 0 3 22-28 2 1975 0 EDT#Canada4 -- 0 3 24-30 4 1976-1986 0 EDT#Canada4 -- 0 3 1-7 4 1987-2038 0 EDT#Canada4 -- 0 1 25-31 10 1970-1973 0 EST5 -- 0 1 24-30 11 1974 0 EST5 -- 0 1 25-31 10 1975-2038 0 EST5 -- NAR, all rows match Eastern Standard Time, Eastern Daylight Time -- Eastern Standard Time, Central Daylight Time (US: Indiana) -- -- This entry is for backward compatibility only, the correct entry -- is the EST5CDT entry above. This entry is incorrect because the -- "6" in EST6CDT below should be a "5". Other than the "6" being -- changed to "5", this entry and EST5CDT are the same and the -- end result of using either is identical. -- -- EST6CDT -- 0 3 24-30 4 1970-1973 0 CDT5 -- 0 3 6 1 1974 0-6 CDT5 -- 0 3 22-28 2 1975 0 CDT5 -- 0 3 24-30 4 1976-1986 0 CDT5 -- 0 3 1-7 4 1987-2038 0 CDT5 -- 0 1 25-31 10 1970-1973 0 EST5 -- 0 1 24-30 11 1974 0 EST5 -- 0 1 25-31 10 1975-2038 0 EST5 -- for values of EST6, we want to mark that we are ALWAYS in DST, -- because of the note above. -- also, Indiana areas with TZ values of EST5CDT will be handled -- in the 4gl code as an exception that has it NEVER being in DST, -- since they add 5 hours to GMT during non-DST time (EST5), -- and also add 5 hours to GMT during DST time, since they used CDT DST INSERT INTO dst VALUES ("EST6",1970,1,1,0,0,1,1) --------------------------- END OF dst.sql ----------------------------- #---------------------------------------------------------------------# FUNCTION sel_dst(ftz, yy) # Arguments: TZ & year we're interested # e.g. MST7 1995 # Purpose: Get the Daylight Savings Time row for given TZ & year # The values of m_dst were derived from HPUX's tztab # Returns: NA; m_dst.* is filled in #---------------------------------------------------------------------# DEFINE ftz CHAR(10) # formatted tz sans DST entry: MST7 DEFINE yy SMALLINT INITIALIZE m_dst.* TO NULL SELECT * INTO m_dst.* FROM dst WHERE tz = ftz AND st_yy = (SELECT MAX(st_yy) FROM dst WHERE tz = ftz AND st_yy <= yy) END FUNCTION # sel_dst(ftz, yy) { Below is the man entry for tztab from HPUX: tztab(4) tztab(4) NAME tztab - time zone adjustment table for date(1) and ctime(3C) DESCRIPTION The tztab file describes the differences between Coordinated Universal Time (UTC) and local time. Several local areas can be represented simultaneously with historical detail. The file tztab consists of one or more time zone adjustment entries. The first line of the entry contains a unique string that may match the value of the TZ string in the user's environment. The format is tzname____dstzname where tzname is the time zone name or abbreviation, ____ is the difference in hours from UTC, and dstzname is the name or abbreviation of the "Daylight Savings" time zone. Fractional values of ____ are expressed in minutes preceded by a colon. Each such string will start with an alphabetic character. The second and subsequent lines of each entry details the time zone adjustments for that time zone. The lines contain seven fields each. The first six fields specify the first minute in which the time zone adjustment, specified in the seventh field, applies. The fields are separated by spaces or tabs. The first six are integer patterns that specify the minute (0-59), hour (0-23), day of the month (1-31), month of the year (1-12), year (1970-2038), and day of the week (0-6, with 0=Sunday). The minute, hour, and month of the year must contain a number in the (respective) range indicated above. The day of the month, year, and day of the week can contain a number as above or two numbers separated by a minus (indicating an inclusive range). Either the day of the month or the day of the week field must be a range, the other must be simple number. The seventh field is a string that describes the time zone adjustment in its simplest form: tzname____ where tzname is an alphabetic string giving the time zone name or abbreviation, and ____ is the difference in hours from UTC. tzname must match either the tzname field or the dstzname field in the first line of the time zone adjustment entry. Any fractional ____ is shown in minutes. Comments begin with a # in the _____ column, and include all characters up to a new-line. Comments are ignored. If the value of the TZ string does not match any line in the table, it is interpreted according to the current U.S. pattern. EXTERNAL INFLUENCES International Code Set Support Single-byte character code sets are supported. EXAMPLES The time zone adjustment table for the Eastern Time Zone in the United States is: Hewlett-Packard Company - 1 - HP-UX Release 9.0: August 1992 tztab(4) tztab(4) EST5EDT 0 3 6 1 1974 0-6 EDT4 0 3 22-28 2 1975 0 EDT4 0 3 24-30 4 1976-1986 0 EDT4 0 3 1-7 4 1987-2038 0 EDT4 0 1 24-30 11 1974 0 EST5 0 1 25-31 10 1975-2038 0 EST5 Normally (as indicated in the first line) Eastern Standard Time is five hours earlier than UTC. During Daylight Savings time, it changes to a 4 hour difference. The first time Daylight Savings Time took effect (second line) was on January 6, 1974 at 3:00 a.m., EDT. Note that the minute before was 1:59 a.m., EST. The change back to standard time took effect (sixth line) on the last Sunday in November of the same year. At that point, the time went from 1:59 a.m. EDT to 1:00 a.m. EST. The transition to Daylight Savings Time since then has gone from the last Sunday in February (third line) to the last Sunday in April (fourth line) to the first Sunday in April (fifth line). The return to standard time for the same period has remained at the last Sunday in October (seventh line). AUTHOR tztab was developed by HP. FILES /usr/lib/tztab SEE ALSO date(1), ctime(3C), environ(5). Hewlett-Packard Company - 2 - HP-UX Release 9.0: August 1992 } { Below is a copy of /usr/lib/tztab from HPUX: # @(#) $Revision: 70.1 $ # Mitteleuropaeische Zeit, Mitteleuropaeische Sommerzeit MEZ-1MESZ 0 3 25-31 3 1983-2038 0 MESZ-2 0 2 24-30 9 1983-2038 0 MEZ-1 # Middle European Time, Middle European Time Daylight Savings Time MET-1METDST 0 3 25-31 3 1983-2038 0 METDST-2 0 2 24-30 9 1983-2038 0 MET-1 # Greenwich Mean Time, British Summer Time GMT0BST 0 3 25-31 3 1983-1984 0 BST-1 0 3 23-29 3 1985-1990 0 BST-1 0 3 25-31 3 1991-2038 0 BST-1 0 1 25-31 10 1983-1985 0 GMT0 0 1 23-29 10 1986-2038 0 GMT0 # Pacific Standard Time, Pacific Daylight Time PST8PDT 0 3 24-30 4 1970-1973 0 PDT7 0 3 6 1 1974 0-6 PDT7 0 3 22-28 2 1975 0 PDT7 0 3 24-30 4 1976-1986 0 PDT7 0 3 1-7 4 1987-2038 0 PDT7 0 1 25-31 10 1970-1973 0 PST8 0 1 24-30 11 1974 0 PST8 0 1 25-31 10 1975-2038 0 PST8 # Eastern Standard Time, Eastern Daylight Time EST5EDT 0 3 24-30 4 1970-1973 0 EDT4 0 3 6 1 1974 0-6 EDT4 0 3 22-28 2 1975 0 EDT4 0 3 24-30 4 1976-1986 0 EDT4 0 3 1-7 4 1987-2038 0 EDT4 0 1 25-31 10 1970-1973 0 EST5 0 1 24-30 11 1974 0 EST5 0 1 25-31 10 1975-2038 0 EST5 # Central Standard Time, Central Daylight Time CST6CDT 0 3 24-30 4 1970-1973 0 CDT5 0 3 6 1 1974 0-6 CDT5 0 3 22-28 2 1975 0 CDT5 0 3 24-30 4 1976-1986 0 CDT5 0 3 1-7 4 1987-2038 0 CDT5 0 1 25-31 10 1970-1973 0 CST6 0 1 24-30 11 1974 0 CST6 0 1 25-31 10 1975-2038 0 CST6 # Mountain Standard Time, Mountain Daylight Time MST7MDT 0 3 24-30 4 1970-1973 0 MDT6 0 3 6 1 1974 0-6 MDT6 0 3 22-28 2 1975 0 MDT6 0 3 24-30 4 1976-1986 0 MDT6 0 3 1-7 4 1987-2038 0 MDT6 0 1 25-31 10 1970-1973 0 MST7 0 1 24-30 11 1974 0 MST7 0 1 25-31 10 1975-2038 0 MST7 # Atlantic Standard Time, Atlantic Daylight Time AST4ADT 0 3 24-30 4 1970-1973 0 ADT3 0 3 6 1 1974 0-6 ADT3 0 3 22-28 2 1975 0 ADT3 0 3 24-30 4 1976-1986 0 ADT3 0 3 1-7 4 1987-2038 0 ADT3 0 1 25-31 10 1970-1973 0 AST4 0 1 24-30 11 1974 0 AST4 0 1 25-31 10 1975-2038 0 AST4 # Newfoundland Standard Time, Newfoundland Daylight Time NST3:30NDT 0 3 24-30 4 1970-1973 0 NDT2:30 0 3 6 1 1974 0-6 NDT2:30 0 3 22-28 2 1975 0 NDT2:30 0 3 24-30 4 1976-1986 0 NDT2:30 0 3 1-7 4 1987-2038 0 NDT2:30 0 1 25-31 10 1970-1973 0 NST3:30 0 1 24-30 11 1974 0 NST3:30 0 1 25-31 10 1975-2038 0 NST3:30 # Eastern Standard Time, Central Daylight Time (US: Indiana) EST5CDT 0 3 24-30 4 1970-1973 0 CDT5 0 3 6 1 1974 0-6 CDT5 0 3 22-28 2 1975 0 CDT5 0 3 24-30 4 1976-1986 0 CDT5 0 3 1-7 4 1987-2038 0 CDT5 0 1 25-31 10 1970-1973 0 EST5 0 1 24-30 11 1974 0 EST5 0 1 25-31 10 1975-2038 0 EST5 # Aleutian Standard Time, Aleutian Daylight Time AST10ADT 0 3 24-30 4 1970-1973 0 ADT9 0 3 6 1 1974 0-6 ADT9 0 3 22-28 2 1975 0 ADT9 0 3 24-30 4 1976-2038 0 ADT9 0 1 25-31 10 1970-1973 0 AST10 0 1 24-30 11 1974 0 AST10 0 1 25-31 10 1975-2038 0 AST10 # Yukon Standard Time, Yukon Daylight Time YST9YDT 0 3 24-30 4 1970-1973 0 YDT8 0 3 6 1 1974 0-6 YDT8 0 3 22-28 2 1975 0 YDT8 0 3 24-30 4 1976-2038 0 YDT8 0 1 25-31 10 1970-1973 0 YST9 0 1 24-30 11 1974 0 YST9 0 1 25-31 10 1975-2038 0 YST9 # Western European Time, Western European Time Daylight Savings Time WET0WETDST 0 3 25-31 3 1983-1984 0 WETDST-1 0 3 23-29 3 1985-2038 0 WETDST-1 0 1 25-31 10 1983-1985 0 WET0 0 1 23-29 10 1986-2038 0 WET0 # Portuguese Winter Time, Portuguese Summer Time PWT0PST 0 3 25-31 3 1983-2038 0 PST-1 0 2 24-30 9 1983-2038 0 PWT0 # South Africa Stardard Time, South Africa Daylight Time SAST-2SADT 0 3 25-31 10 1985-2038 0 SADT-3 0 1 1-7 3 1985-2038 0 SAST-2 # Australian Central Standard Time, Australian Central Daylight Time CST-9:30CDT 0 3 25-31 10 1971-2038 0 CDT-10:30 0 1 27 2 1972 0-6 CST-9:30 0 1 1-7 3 1973-2038 0 CST-9:30 # Australian Eastern Standard Time, Australian Eastern Daylight Time EST-10EDT 0 3 25-31 10 1971-2038 0 EDT-11 0 1 27 2 1972 0-6 EST-10 0 1 1-7 3 1973-1985 0 EST-10 0 1 15-21 3 1986 0 EST-10 0 1 1-7 3 1987-2038 0 EST-10 # New Zealand Stardard Time, New Zealand Daylight Time # NZST-12NZDT 0 3 25-31 10 1985-1988 0 NZDT-13 0 3 8 10 1989 0-6 NZDT-13 0 3 1-7 10 1990-1999 0 NZDT-13 0 1 1-7 3 1985-1989 0 NZST-12 0 1 15-21 3 1990-1999 0 NZST-12 # The timezones named above should be used in preference to those below except # for dates prior to 1987 for Tasmania. US and Canada use the same rules so # the simpler timezone strings above will work for both countries. # Australian Eastern Standard Time, Australian Eastern Daylight Time (Tasmania) # (same as EST-10EDT for 1987 - 2038) EST-10EDT#Tasmania 0 3 25-31 10 1971-2038 0 EDT#Tasmania-11 0 1 27 2 1972 0-6 EST-10 0 1 1-7 3 1973-2038 0 EST-10 # Pacific Standard Time, Pacific Daylight Time (Canada) PST8PDT#Canada 0 3 24-30 4 1970-1973 0 PDT#Canada7 0 3 6 1 1974 0-6 PDT#Canada7 0 3 22-28 2 1975 0 PDT#Canada7 0 3 24-30 4 1976-1986 0 PDT#Canada7 0 3 1-7 4 1987-2038 0 PDT#Canada7 0 1 25-31 10 1970-1973 0 PST8 0 1 24-30 11 1974 0 PST8 0 1 25-31 10 1975-2038 0 PST8 # Mountain Standard Time, Mountain Daylight Time (Canada) MST7MDT#Canada 0 3 24-30 4 1970-1973 0 MDT#Canada6 0 3 6 1 1974 0-6 MDT#Canada6 0 3 22-28 2 1975 0 MDT#Canada6 0 3 24-30 4 1976-1986 0 MDT#Canada6 0 3 1-7 4 1987-2038 0 MDT#Canada6 0 1 25-31 10 1970-1973 0 MST7 0 1 24-30 11 1974 0 MST7 0 1 25-31 10 1975-2038 0 MST7 # Central Standard Time, Central Daylight Time (Canada) CST6CDT#Canada 0 3 24-30 4 1970-1973 0 CDT#Canada5 0 3 6 1 1974 0-6 CDT#Canada5 0 3 22-28 2 1975 0 CDT#Canada5 0 3 24-30 4 1976-1986 0 CDT#Canada5 0 3 1-7 4 1987-2038 0 CDT#Canada5 0 1 25-31 10 1970-1973 0 CST6 0 1 24-30 11 1974 0 CST6 0 1 25-31 10 1975-2038 0 CST6 # Eastern Standard Time, Eastern Daylight Time (Canada) EST5EDT#Canada 0 3 24-30 4 1970-1973 0 EDT#Canada4 0 3 6 1 1974 0-6 EDT#Canada4 0 3 22-28 2 1975 0 EDT#Canada4 0 3 24-30 4 1976-1986 0 EDT#Canada4 0 3 1-7 4 1987-2038 0 EDT#Canada4 0 1 25-31 10 1970-1973 0 EST5 0 1 24-30 11 1974 0 EST5 0 1 25-31 10 1975-2038 0 EST5 # Eastern Standard Time, Central Daylight Time (US: Indiana) # # This entry is for backward compatibility only, the correct entry # is the EST5CDT entry above. This entry is incorrect because the # "6" in EST6CDT below should be a "5". Other than the "6" being # changed to "5", this entry and EST5CDT are the same and the # end result of using either is identical. # EST6CDT 0 3 24-30 4 1970-1973 0 CDT5 0 3 6 1 1974 0-6 CDT5 0 3 22-28 2 1975 0 CDT5 0 3 24-30 4 1976-1986 0 CDT5 0 3 1-7 4 1987-2038 0 CDT5 0 1 25-31 10 1970-1973 0 EST5 0 1 24-30 11 1974 0 EST5 0 1 25-31 10 1975-2038 0 EST5 }