1

I have a custom setting of List type and it has got a field of datetime. When I create record for the custom setting and provide value to it. Does salesforce store it as it is without converting it to GMT? Because I apex I am getting what I entered not the converted value in GMT. Any thoughts?

4

Salesforce always stores the date/time in GMT.

When you save the record it converts from the logged-in user's local timezone to GMT. And when you view the record it converts back from GMT to the logged-in user's local timezone.

1

Salesforce does indeed store your value in GMT (UTC) and then converts it back. If you want to display the date time in the logged in user's time zone on a visualforce page, you need to use <apex:outputfield> instead of <apex:outputtext>, that way visual force will use the locale and timezone of the user.

Outputfield (and by extend, inputfield) can only be used when bound to an sobjectfield, you can use this to render currency correctly or percentages, or any type of sobject field type.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.