Loading

Data Loader adds extra hours to 'date-time' fields in Salesforce

Udgivelsesdato: Oct 13, 2022
Beskrivelse

When you import, update, or upsert Date/Time fields with the Data Loader you might see different times when you view the data via the Salesforce user interface (UI) than what you have set in your .csv source file. Similarly, users may find that Date/Time field values exported from Salesforce do not seem to match the values that exist in the records when viewed through the UI.

When you view the record from within the Salesforce UI, the value is automatically translated to and displayed in the timezone set on your user record. However, when the data is inserted, updated, or exported the values will always be in GMT (or UTC) time and are not translated to the running user's timezone.

For more information, review the details for the dateTime Primitive Data Types documentation.
Løsning

 

Date/Time fields are stored internally in UTC or Universal Time Coordinated time, which aligns with Greenwich Mean Time (GMT)


If your user's time zone is not GMT, but for example GMT+1, an extra hour will be added when viewing the data via the UI in Salesforce.

For example: 

If the Date/Time field in the CSV file is: 
2016-03-01T08:00:00.000Z  (Z stands for UTC time)

Then the Date/Time field in the Salesforce UI will be: 
01/03/2016 09:00

Salesforce just added +1 hour to the time field, because the user's time zone is GMT+1.


When the Daylight Savings Time (DST / "summer time") applies, it adjusts the time based on the viewing users Time Zone settings, + 1 hour in most cases. 

In this case, if the user's time zone GMT+1 (as an example) the following applies:

If the Date/Time field in the CSV file is: 
2016-08-20T08:00:00.000Z  (Z stands for UTC time)

Then the Date/Time field in the Salesforce UI will be:
20/08/2016 10:00

You will see, that Salesforce adds +2 hours:
+1 hour because the user's time zone is GMT+1
+1 hour because of the DST: it adds +1 hour to the winter time.

These examples presented with the GMT+1 time zone, but the rule applies to any time zone, and the +1 hour DST for any location, where DST applies.


See also:
Format the 'Date' and 'Date Time' data in a CSV file
Date field displays the previous day after import
Vidensartikelnummer

000387083

 
Indlæser
Salesforce Help | Article