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
Aasif_Aasif_ 

Date/Time Field - Independent of User Locale

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.
KevinPKevinP
you can do this, but you'll need to read / write from the field via apex. 

The general idea, is to store not a date/time itself but the number of seconds since the epoch (1/1/1970) at midnight. 

The DateTime method getTime() will return the # of milliseconds since epoch, so store the results of datetime.getTime()/1000