0

What is the best way to create a date/time field which doesnot automatically change date/time according to logged-in user's timezone?

For example, if User1 (PST) sets the value in a date/time field as "01/01/2016 4:00 PM", then User2 (EST) should see same value in that field and not "01/01/2016 7:00 PM".

We tried using a text field and stamp this date/time on it, but the sorting on this field doesn't work.

Is there any other option?

Important requirement is - that the sorting should work properly and should be based on date/time value.

  • Can you tell us more about your purpose and what it is that you want to accomplish? All Date?Time fields are stored in GMT, then converted to the user's local time. You'll have to store them in some other format if you don't want that to occur. The time that's entered is still the same in GMT regardless of where you are. Perhaps you want to have your users convert the time to GMT when it's entered? That's why I'm asking about what you want to accomplish. All times entered get converted to the user's local time regardless of who entered them. – crmprogdev Jan 29 '16 at 19:49
  • @crmprogdev - The requirement is to provide user the ease to -"not have to convert timezone manually". As you said, Salesforce date/time field inherently get converted according to user's local time - we dont want that to happen (or) come up with a way to show the time as originally entered. (in the same date/time format) – SF Ninja Jan 29 '16 at 20:41
1

The only way you can get the value to remain time-zone agnostic and be sortable would be to store the date/time value in a normal text field that is roughly laid out in the following order: YEAR MONTH DAY HOUR MINUTE SECOND, where HOUR is in a 24-hour format, or immediately followed by A or P (for AM or PM). For example, you could write it as a normal ISO-8601 format, such as 2016-01-29 13:36:00 -07:00. You'll probably want to include the time zone so the user can know how to translate it back to their own local time.

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.