Question
Cognizant
IN
Last activity: 17 Feb 2021 10:20 EST
How to check day light savings is OFF or ON in Pega
Hi team,
Do we have a flag or any mechanism to check whether Day Light Savings is OFF or ON.
***Edited by Moderator Marissa to update platform capability tags****
-
Likes (1)
Appalanaidu Bobbili -
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
Accepted Solution
Pegasystems Inc.
IN
Hi @SarbarthaR4428,
Below is the approach you can follow in pega to know for the DayLight on or off. I followed and get the day light status
1) Create an activity and add an local variable as shown below
2) Implement the following steps in the activity
Java step : IsDayLight = java.util.TimeZone.getDefault().inDaylightTime( new Date() );
This api returns true or false. true means ON, false means OFF. You can use following api, if you want to get the day light value based on timezone
java.util.TimeZone.getTimeZone( "US/Alaska").inDaylightTime( new Date() );
Hi @SarbarthaR4428,
Below is the approach you can follow in pega to know for the DayLight on or off. I followed and get the day light status
1) Create an activity and add an local variable as shown below
2) Implement the following steps in the activity
Java step : IsDayLight = java.util.TimeZone.getDefault().inDaylightTime( new Date() );
This api returns true or false. true means ON, false means OFF. You can use following api, if you want to get the day light value based on timezone
java.util.TimeZone.getTimeZone( "US/Alaska").inDaylightTime( new Date() );
The IsDayLighOn property is truefalse type in PEGA.
Save the activity and run it whenever needed in the application to see the value of the IsDaylightOn property is set to true or false.
I ran it on a button with "Refresh-this-Section and activity" and saw the result
The end result is
Thats It !. Hope this helps !!
Please feel free to reply for any questions,
Thank you,
Regards, Cherb.
Pegasystems Inc.
IN
Hello,
Time zone and Daylight Savings Time conversions
Pega Platform uses the time zones provided by the JVM on which it runs. The JVM typically uses data provided by the Olson TZ database. Details on this database are available from https://www.iana.org/time-zones.
Note: Daylight savings time rules are supplied by Java JDK vendors. In a multinode system, it is important that the same rules are installed on each node. For details of vendor JDK support of daylight savings time and downloads, see the Oracle knowledge base.
Accepted Solution
Pegasystems Inc.
IN
Hi @SarbarthaR4428,
Below is the approach you can follow in pega to know for the DayLight on or off. I followed and get the day light status
1) Create an activity and add an local variable as shown below
2) Implement the following steps in the activity
Java step : IsDayLight = java.util.TimeZone.getDefault().inDaylightTime( new Date() );
This api returns true or false. true means ON, false means OFF. You can use following api, if you want to get the day light value based on timezone
java.util.TimeZone.getTimeZone( "US/Alaska").inDaylightTime( new Date() );
Hi @SarbarthaR4428,
Below is the approach you can follow in pega to know for the DayLight on or off. I followed and get the day light status
1) Create an activity and add an local variable as shown below
2) Implement the following steps in the activity
Java step : IsDayLight = java.util.TimeZone.getDefault().inDaylightTime( new Date() );
This api returns true or false. true means ON, false means OFF. You can use following api, if you want to get the day light value based on timezone
java.util.TimeZone.getTimeZone( "US/Alaska").inDaylightTime( new Date() );
The IsDayLighOn property is truefalse type in PEGA.
Save the activity and run it whenever needed in the application to see the value of the IsDaylightOn property is set to true or false.
I ran it on a button with "Refresh-this-Section and activity" and saw the result
The end result is
Thats It !. Hope this helps !!
Please feel free to reply for any questions,
Thank you,
Regards, Cherb.
-
Shreeram Kumar
Cognizant
IN
Can we convert this as a function instead of Activity rule.
Pegasystems Inc.
IN
Yes. Absolutely. That is a java code and functions accept java code. You can convert as a function.
Cognizant
IN
Thank you. I have created a parameterized function. Which is re usable and can be called from any rule
Pegasystems Inc.
IN
Great. The function seems perfect !.
I'm glad to help you to achieve what you are look for !