Convert to CST from server time zone (EST) in client side
Question
Application Type
Reactive

My requirement is to convert server time zone( that is in EST) to CST time zone.

 Tried different ways but its taking my local time also in consideration while converting. My client expectation is always the date time to display as CST irrespective of local time zone .(Forge component used : TimezoneReactiveUtils)

ConvertDateTimeByTimezoneOffset(GetClaims.List.Current.Case.CreatedOn,-TextToInteger(GetCurrentTimezoneOffset())

Here, If i hard code GetCurrentTimezoneOffset to 300 , it works fine but it fails again on daylight saving days.

Need someone help in this criteria.

Hi Mahesh

I use the Time Zone component from Forge (https://www.outsystems.com/forge/component-overview/500/time-zone)
It's for traditional but you can use its server actions to get the offset and then use it to convert using the reactive functions


Regards

Thanks for your reply but i cant use server actions in my scenario. I have to try with client action through

Hi Mahesh,

you use Reactive, so a datetime in client side is by default expressed in the users timezone.  At this point, the server timezone becomes irrelevant.

To get from there to the desired timezone, you make detour over UTC.  This can be done with functions from the component you are referring to : TimezoneReactiveUtils.

So this will do the trick, with the -360 being the offset between UTC and CST :

ConvertDateTimeByTimezoneOffset(ConvertDateTimeToUTC(GetClaims.List.Current.Case.CreatedOn
),TimezoneOffset:-360)

Dorine

Thanks for your reply...

Is there any built in function to identify daylight saving ?

Because Relying on getTimezoneOffset() is not correct in all cases. It does return the current timezone offset, but when converting a date, we should take the offset at that specific date, not the current one. 

It's a bug in the current component, that needs to be fixed. Or any other alternative?

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.