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
nishwalnishwal 

Record's CreatedDate timezone

There is a Record Creater User A  with timezone is Timezone A and Record Viewer is another User B with TimezoneB.  

 

I have a custom object with Datetime field. When i fetch this record using SOQL for User B, SF gives the Datetime value in GMT with respect to the creator user's timezone and i wanted to get the absolute value that i have entered. I didnot find any way to identify in which timezone i have created that record. 

 

Can anybody tell me that how can i fetch that a record is created in which timezone?

Alok_NagarroAlok_Nagarro

Hi,

 

It depends on user, who is creating record,so if user with timezone A is created record then created record will inharit same timezone of created user(time zone a).so doesn't matter who is accessing this record .

nishwalnishwal

You are right alok in saying that record will inherit the Creator User's timezone however if we change the CreatedBy User's timezone after creating the record then Record's Timezone does not changes.

 

My actual problem lies in salesforce datetime storage and retrieval behavior. It does not store the absolute value of datetime field rather saves the GMT converted values. So when User B with another timezone retrieves this values , will get GMT time with respective of Timezone A.

 

Example : User A with Amsterdam Timezone stores 03:30 PM and User B with India timezone fetch this value , it will return 13:30 instead of 15:30. This difference is User A's timezone offset (GMT + 2).

tantoniotantonio

I am seeing a similar issue in my Org. 

 

We have records that were created by User B in Timezone A (They were using the wrong timezone to begin with) . These records convert to GMT based on Timezone A based on the User setting. 

 

User B's timezone is then corrected to Timezone B and the user continues to create records. 

 

How can I tell which records need to be adjusted and which ones are accurate? I would need to know one of the two followingthings:

-The exact date and time the user corrected their time zone

-The time zone GMT convertion was based on when the record was created <--- I'd prefer this

 

 

Pradeep RajuPradeep Raju
Hello, 

I'm also facing the same issue while getting the createdtime in apex. Any solution for this Irrespective of the user who is accesing the record we need to get the time that is being dispayed at the record level. Please help.

Regards,
Pradeep.