Focal Point
[CLOSED] Time Zone and Daylight Savings Time

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/9071099882

June 23, 2008, 04:40 PM
Francis Mariani
[CLOSED] Time Zone and Daylight Savings Time
I used this FocalPoint tip Using Reg.exe to Offset Time Zones From a Windows-Based System to determine the number of hours by which I need to offset dates stored in Microsoft CRM tables (they're stored in GMT). Unfortunately, the technique described does not take into account Daylight Savings Time. Based on the tip, to determine the Date-Time in Toronto, the offset is -4 hours. But at the moment, it is actually -5 hours, so it looks like I have to amend the offset by subtracting 1 from it when the run date is during Daylight Savings Time.

According to Daylight Saving Time in the United States (and Canada too), DST is between the second Sunday in March and the first Sunday in November.

Is there a better method of determining if we are in DST than using the WF Date Move functions?

This message has been edited. Last edited by: FP Mod Chuck,


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
June 23, 2008, 04:50 PM
Francis Mariani
This reads like an April Fools Day joke: Daylight Savings in the Year 2010


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
June 23, 2008, 04:54 PM
Francis Mariani
I'm thinking of hardcoding the dates based on this:

2007 Daylight Savings Time


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
June 23, 2008, 05:29 PM
Prarie
Yes...that did read like an Aprils Fool Joke


In Focus since 1993. WebFOCUS 7.7.03 Win 2003
I think the best part is the hyperlink on Politicians -

Politicians at Shopping.com - Find, Compare and Buy. Shop & Save at 1000's of Stores.

Just who would want to buy one, spelt with or without a small "p"!

T
From the look of it, it seems to be that DST starts in the second weekend of March and ends in the first weekend of November. That would make it easier to compute the date, wouldn't it?


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
Francis,

I had to write a DEFINE FUNCTION to use for this because I also have a system that stores dates in GMT. The following code is based on Daylight Savings rules for East Coast USA. Call the function by passing a Smart Date format to it and it returns a Y or N to indicate whether or not the date is in Daylight Savings time of the year.

-***************************************
-* The following function is used to
-* determine whether or not a certain
-* date is during day light savings time
-* or not.
-* RETURN FORMAT: A1 (Y or N)
-***************************************
DEFINE FUNCTION DSTIMEYN (CURNT_DT/YYMD)
CURNT_YR/YY=CURNT_DT;
CURNT_MT/M =CURNT_DT;
CURNT_DOW/W=CURNT_DT;
CURNT_DOM/D=CURNT_DT;
CURNT_I_DOW/I1=CURNT_DOW;
CURNT_I_DOM/I2=CURNT_DOM;
-***************************************
MTH_ID/A4 =
IF (CURNT_YR LE '2006') THEN
DECODE CURNT_MT( 4 '0604' 10 '0610' ELSE '????') ELSE
DECODE CURNT_MT( 3 '0703' 11 '0711' ELSE '????');
-***************************************
-* The following are used for 2006 and prior.
-***************************************
APR_ID/A1 =
IF (CURNT_I_DOM GE 8) THEN 'Y' ELSE
IF (CURNT_I_DOW EQ 7) THEN 'Y' ELSE
IF (CURNT_I_DOW EQ CURNT_I_DOM) THEN 'N' ELSE
IF (CURNT_I_DOW GT CURNT_I_DOM) THEN 'N' ELSE 'Y';
OCT_ID/A1 =
IF (CURNT_I_DOM LE 24) THEN 'Y' ELSE
IF (CURNT_I_DOW EQ 7) THEN 'N' ELSE
IF (CURNT_I_DOW EQ (CURNT_I_DOM - 24)) THEN 'Y' ELSE
IF (CURNT_I_DOW GT (CURNT_I_DOM - 24)) THEN 'Y' ELSE 'N';
-***************************************
-* The following are used for 2007 and beyond.
-***************************************
MAR_ID/A1 =
IF (CURNT_I_DOM LE 7) THEN 'N' ELSE
IF (CURNT_I_DOM GE 15) THEN 'Y' ELSE
IF (CURNT_I_DOW EQ 7) THEN 'Y' ELSE
IF (CURNT_I_DOW EQ (CURNT_I_DOM - 7)) THEN 'N' ELSE
IF (CURNT_I_DOW GT (CURNT_I_DOM - 7)) THEN 'N' ELSE 'Y';
NOV_ID/A1 =
IF (CURNT_I_DOM GE 8) THEN 'N' ELSE
IF (CURNT_I_DOW EQ 7) THEN 'N' ELSE
IF (CURNT_I_DOW EQ CURNT_I_DOM) THEN 'Y' ELSE
IF (CURNT_I_DOW GT CURNT_I_DOM) THEN 'Y' ELSE 'N';
-***************************************
DSTIMEYN/A1=
IF (CURNT_YR LE '2006') AND (MTH_ID EQ '????') THEN
DECODE CURNT_MT(1 N 2 N 3 N 4 ? 5 Y 6 Y 7 Y 8 Y 9 Y 10 ? 11 N 12 N) ELSE
IF (CURNT_YR GT '2006') AND (MTH_ID EQ '????') THEN
DECODE CURNT_MT(1 N 2 N 3 ? 4 Y 5 Y 6 Y 7 Y 8 Y 9 Y 10 Y 11 ? 12 N) ELSE
IF (MTH_ID EQ '0604') THEN APR_ID ELSE
IF (MTH_ID EQ '0610') THEN OCT_ID ELSE
IF (MTH_ID EQ '0703') THEN MAR_ID ELSE
IF (MTH_ID EQ '0711') THEN NOV_ID ELSE '@';
END


Thanks!

Mickey

FOCUS/WebFOCUS 1990 - 2011
All I can say is Our taxes at work. Someone sent me a link recently that was a congressman commenting on the law requiring the new energy savings light bulbs. What it boils down to is when they burn out or if they break they are hazardous waste. It would do me no good to send it to my congressman and say repeal that stupid law, it was him giving the speech!


Pat
WF 7.6.8, AIX, AS400, NT
AS400 FOCUS, AIX FOCUS,
Oracle, DB2, JDE, Lotus Notes
They have mercury in them??? Guess we will need a special bucket to put them in. They do last a long time...

Good Routine Mickey.
Mickey, thanks for sharing the function - I think I can incorporate that in my code.

Regards,


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
Prarie,

The new light bulbs are hazardous waste! If you break one, you are supposed to get all pets and people out of the room, open a window (how are you going to do that without someone in the room?) use stiff pieces of cardboard to scoop up the residue (I always have some handy) and then use duck tape to pick up any remaining residue. Double bag the waste. The instructions forgot the part about putting on your hazmat suit!

The good news is Home Depot will recyle them for you if they are not broken.


Pat
WF 7.6.8, AIX, AS400, NT
AS400 FOCUS, AIX FOCUS,
Oracle, DB2, JDE, Lotus Notes
guess just Duct tape yourself. Didn't know about Home Depot..thanks


In Focus since 1993. WebFOCUS 7.7.03 Win 2003
I received the following email in late MArch regarding these bulbs:

You are being encouraged to replace your incandescent light bulbs with compact fluorescent lamps (CFLs) because they are energy efficient, but are they harmful? The Environmental Protection Agency says that CFLs are safe to use; however, they do contain very small amounts of mercury that may be harmful t if the bulb breaks and the mercury is exposed. So what can you do at home to reduce the risk?

Before cleaning-up the broken CFL have people and pets leave the room without walking through the area where the CFL broke on their way out; shut off the central forced-air heating/air conditioning system, if you have one; and open a window and leave the room yourself for at least 15 minutes.

When clean-up is on a hard surface carefully scoop up glass fragments and powder using stiff paper or cardboard and place them in a glass jar with metal lid (such as a canning jar) or in a sealed plastic bag; use sticky tape, such as duct tape, to pick up any remaining small glass fragments and powder; wipe the area clean with damp paper towels or disposable wipe and place them in the glass jar or plastic bag; and do not use a vacuum or broom to clean up the broken bulb on hard surfaces.

When clean-up is on a carpet or rug carefully pick up glass fragments and place them in a glass jar with metal lid (such as a canning jar) or in a sealed plastic bag; use sticky tape, such as duct tape, to pick up any remaining small glass fragments and powder; only after all visible materials are removed, vacuum the area where the bulb was broken; and remove the vacuum bag (or empty and wipe the canister), and put the bag or vacuum debris in a sealed plastic bag.

When the clean-up is done you should dispose of the clean-up materials immediately by placing them outside your home in a trash container or outdoor protected area and wash your hands after disposing of the jars or plastic bags containing clean-up materials. Check with your local government to find out how to dispose of the broken bulb and clean-up material.

In the future when cleaning the carpet or rug shut off the central forced-air heating/air conditioning system and open a window prior to vacuuming and keep the central heating/air conditioning system shut off and the window open for at least 15 minutes after vacuuming is completed.

For more information on CFLs visit http://www.epa.gov/bulbrecycling


Thanks!

Mickey

FOCUS/WebFOCUS 1990 - 2011
Don't know how we got so far off the subject --- but I think I'll stick with the plain old bulbs - sounds like they require a LOT less energy to me!!


Regards,

Darin



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat
They forgot to mention that, after cleanup, you need to emigrate to the Australian Outback for five years until the mercury has dissipated.


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
We do this natively in the custom ERP software we provide our customers, including considering historical changes to DST rules.

I have been working with IBI specifyhign an NFR to include natively in WF, especially accessible though IA, in IBI Case# 82502503

If this is something you may be interested in, let your rep know. I can provide details on my case.


WebFOCUS 7.7.04M/8001
Windows Server 2008
Excel, PDF, HTML, AHTML

http://www.plex.com
"I have been working with IBI specifying an NFR" more than once, but I haven't seen any results yet (not related to DST).


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
I hear ya ... I've been more successful than that, they delivered a multi-tenant upload (data segragation) for 8001 to our specifications. It was a multi-month process starting shortly after Summit.

But, I've put a lot of effort into working closely with them: a lot of man hours, documentation and calls from my side.

Even just a few cases expressing support for some native, user-level (that's where I want it) DST support in WF could work. If that seems "a bridge to far", I have ideas and am willing to collaborate on ideas I like with others. Getting multiple customers to document business cases for the same failry narrowly defined NFR can work.


WebFOCUS 7.7.04M/8001
Windows Server 2008
Excel, PDF, HTML, AHTML

http://www.plex.com
Tom -

Location and date determine both the applicable time-zone, and the applicability of the DST shift.

In your proposal, how is location to be specified? -- will fex code SET the time zone? the state? Both?

Note that Indiana is still split across two time zones.
Yes, you are right, location and date determine both the applicable time-zone, and the applicability of the DST shift. Date is important, because as you have said Indiana has two timezones, but their application of DST has changed over time, as has the whole of the U.S.

We handle all those intricacies in our ERP and looking for a consistent experience for our users since as a SaaS provider we give them the ERP along the BI functionality of WF.

So, and it took us a few years to get it settled, but we handle all these time zone issues with a few tables (every TZ, the history of it its DST application, a junction table between tenants and their TZ) and then a re-usable function that takes a date and its TZ and converts it to the date in the tenant's TZ.

My proprosal is that TZ be a user attribute, set on either the user form or the user profile. Certain things like &TOD should be handled automatically, but functions like HDIFF should have TZ-enabling parameters or a TZ-aware version of the function.

I have about a half-dozen pages describing my proposal attached to IBI Case #82502503 that I am willing to share and get commentary on.


WebFOCUS 7.7.04M/8001
Windows Server 2008
Excel, PDF, HTML, AHTML

http://www.plex.com
Hi, I'm running into this coding issue as well. What do your question marks ("?") represent? Thanks
MTH_ID/A4 =
IF (CURNT_YR LE '2006') THEN
DECODE CURNT_MT( 4 '0604' 10 '0610' ELSE '????') ELSE
DECODE CURNT_MT( 3 '0703' 11 '0711' ELSE '????');


Denny, if you mean the ???? in Mickey's function, he's outputting ???? when something invalid was passed as input.


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server