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
CapricornCapricorn 

Converting System TimeZone to user TimeZone

Hi,

Reading through the forums, i found many options but still havent manage to get a working solution.
The data in SFDC backend is stored as per organisation timezone. On accessing it in a s-control, i want a date displayed to be converted to User's Time Zone.

I am using the Ajax toolkit  8.0 to get the following:

var user = sforce.connection.getUserInfo();
alert("your timezone is: " + user.userTimeZone);

However this returns me America/Los_Angeles, where as i want a value such as GMT +7 etc. I would then use this to calculate the offset from the base GMT time stored in SFDC to convert it to User Timezone.

Any help anyone?

Cheers
Caps
pnakadapnakada
Having the offset in the timezone will not help you since the offset is dependent on the the date that you wish to convert.   A date in the summer will need a different offset from a date in winter and the rules are all different for the differnt timezones. 
 
Your best bet is to use javascript to convert the time using the timezone specified by the user's client host which should match the user's salesforce timezone. 
 
charucharu
Hi,
    I again have one query regarding time zone that, how can we calculate time from user time zone. If we use userinfoResults it will return the name of time zone. But we want the offset of that particular time zone, or how can we convert the time using the timezone specified by the user's client host which should match the user's salesforce timezone.
charucharu
Hi,

    Can anyone tell me, How can we convert UserTimeZone to System TimeZone?
In my application, i need to update user time zone with system time zone.