Do we have something like in Daylight Time method in Pega
Hi,
I was looking for a method or function like Java's java.util.TimeZone.inDaylightTime() which returns true if the given date is in daylight savings time.
I have a custom requirement for a user to enter a Close Date, e.g., 05/31/2021 (step 1) then I need to save this by appending or adding the closing hours 05:30 PM CT (CST/CDT) to the Date (step 2). The final date time should be something like 05/31/2021 05:30 PM. I'm doing something like this in a Data Transform:
- Param.EndTime = .RequestCloseDate
- Param.EndTime = @addToDate(Param.EndTime,"0","18","30","0")
- Param.EndTime = @FormatDateTime(Param.EndTime,"","CST","en_US")
- .RequestCloseDate = Param.EndTime
* I noticed for step 3 even when I formatted the date to CST, the date stored in the property (step 4) is still in GMT
I did some tests to know that by adding 18 hours and 30 min (step 2) to the GMT date, I will get the proper 05:30 PM time in CST.
I live in a country that uses the CST timezone, and during my tests, it worked fine. However, for some teammates in a different timezone like CT or CDT, the result was offset +1 hour...
I think if I know that the user is in daylight savings time, I can subtract one hour to the close date and display it properly.
Thanks for any thoughts on this,
-Jose