I am upserting data to Datetime fields using the Bulk API.

Here is an example Datetime value that I've loaded to a record (from the Bulk API logs to confirm):

[{"External_Id__c": "ABC123", "Last_Login__c": "2020-09-12T05:16:02.920634"}]

Converted to my timezone in the Salesforce UI, that is 2020-09-12 12:16:02 AM.

However, in the Salesforce UI, after it is displayed in my timezone of CST, it is: 2020-09-12 12:31 AM

I understand the 5 hour time zone difference between the value loaded and the value displayed, but how can the time be off by an additional 15 mins 18 secs? The difference is not consistent. Another example (in addition to 5 hours), is off 10 mins. Another was off 3 minutes.

1 Answer 1


It's those microseconds in your datetime: .920634.

The Salesforce API generally accepts milliseconds (.123) in ISO8601 date times, although they also sometimes get truncated on insert to .000. What appears to be happening here is your microseconds are being interpreted as milliseconds and added to the date.

Note that 920634/1000/60 (interpreting as milliseconds!) is 15.34 minutes, right at your delta value.

You can work around this problem by truncating your input data to three digits' worth of milliseconds. The Bulk API Developer Guide specifies the required format for DateTime values, which is a three-digit milliseconds field.

  • 1
    Nice spot. Completely bonkers behaviour by Salesforce of course...
    – Phil W
    Mar 4, 2021 at 21:35
  • David - Wow. This is wild! Appreciate it.
    – Coogle
    Mar 4, 2021 at 21:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .