Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does salesforce.com have a timezone field that is DST aware?

Tags:

salesforce

I am mailing out reminders to potential customers and the time is getting converted to our servers timezone EST (I think it is currently using EDT though as appropriate). I need to store the timezone for the potential customer and translate the time into their current timezone.

I can store the offset but I am worried about daylight savings time. I can always store a non-DST offset but that causes issues when the signup appointment is scheduled before DST but occurs after DST.

Ideally I would like to store a timezone and have salesforce translate the datetime to that timezone accounting for DST if necessary. How can I do this?

like image 514
vfilby Avatar asked May 20 '10 16:05

vfilby


People also ask

Does Salesforce adjust for Daylight Savings?

If the option selected includes Daylight Time, then yes, Salesforce will automatically update the time to reflect Daylight Savings Time. If Standard Time is selected, then the time will always remain according to Standard Time and will not adjust with Daylight Savings.

How do I add a timezone in Salesforce?

Enter Personal Information in the Quick Find box, then select Personal Information. Then click Edit. Click the Time Zone dropdown list for a list of supported time zones.

How do timezones work in Salesforce?

In Salesforce, every time you instantiate and insert a DateTime object, it gets saved in the database in GMT Time Zone and it is translated to the user's time zone when reading it.


1 Answers

Salesforce won't convert the UTC value stored in the DB to an arbitrary timezone. It will only convert to the timezone of the in-context user. You could try changing locales of the active user every time you make an API call, but that would be expensive.

Like you said, you need to store the timezone, then use the datetime library and convert from the timezone of your salesforce user (it's probably easier to have a user who is in UTC, but not necessary) to the timezone of your customer.

like image 172
Dan K. Avatar answered Oct 04 '22 23:10

Dan K.