function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
eddieeddie 

Datetime fields and User Timezones

I�d like to allow users work with datetime fields using times based on the time zone set for their SFDC account, just as they appear in when logged via the web interface. Using .NET, the datetime values I receive back from the API have been converted to my machine�s local time zone. I realize that this is a .NET issue, and that I can convert these back into UTC as needed, but I need a way to then convert the UTC datetime to reflect the user�s time zone. Also, I need a way to take a dateime in from a user in their account�s local time (again not my machines) and convert it to UTC for sending in to the API.

 

Is there a way that I can obtain the time zone offset (DST aware) for a given user?  The User.Timezone field gives me a string â¬?region/keyâ¬? based time zone instead of an offset, so I can only make use of that with some sort of external lookup.

 

Is there a way to convert a datetime from a user�s local time into UTC using the same offset DST rules that would be used through the web based UI?