How do we get user's time zone offset integer in Apex or Formula Field?
For example, a user's personal information time zone
(GMT-04:00) Eastern Daylight Time (America/New_York)
should return -4
.
More information:
My requirement to have a commandButton Apex class
which assigns custom object records to Users if the
custom object's state's time zone == the current user's time zone.
Hence, I created two fields on my custom object:
State__c
- for 2 letter USA state codeGMT_Offset__c
- formula field which maps all USA states to a time zone offset integer
However, I am unable to get the current user's time zone offset integer.