Wednesday, 9 September 2015

What is the format for Date and Date/Time values through the API or Data Loader?




Description Date or date time field uploaded from CSV files using Data Loader doesn't match what is displayed on Salesforce when admin/user check those imported records using web browser.
Resolution To insert record into Date or Date Time field using Data Loader:

1) "Date" type field accept either one of below format:
  • yyyy-mm-dd
  • yyyy-mm-dd hh:mm:ss
  • yyyy-mm-ddThh:mm:ssZ
  • yyyy-mm-ddThh:mm:ss.sssZ

2) "Date Time" type field accept either one of below format:
  • yyyy-mm-dd hh:mm:ss
  • yyyy-mm-ddThh:mm:ssZ
  • yyyy-mm-ddThh:mm:ss.sssZ
Example: user/admin set their SF timezone to "China/Taiwan timezone GMT+8" (admin/user set his or her time zone in SF under Setup | Personal Setup | My Personal Information | Personal Information | Timezone Setting )

  • If your field Data Type is "Date" type and Data Loader Timezone setting: "GMT+0" or "GMT" or blank, your example data in your import spreadsheet can be either one of below:
2011-01-10
2011-01-10 00:00:00
2011-01-10T00:00:00Z
2011-01-10T00:00:00.000Z
  • If your field Data Type is "Date" type and Data Loader Timezone setting: "GMT+8", your example data in your import spreadsheet must only be either one of below (if you set the hh:mm:ss to 00:00:00, the import date data in SF will display previous day '2011-01-09' instead of '2011-01-10'):
2011-01-10 08:00:00
2011-01-10T08:00:00Z
2011-01-10T08:00:00.000Z
  • If your field Data Type is "Date Time" type and Data Loader Timezone setting: "GMT+8", your example data in your import spreadsheet must be either one of below in order to have the Date Time displaying from SF exactly what you imported in spreadsheet:
2011-01-10 XX:XX:XX
2011-01-10TXX:XX:XXZ
2011-01-10TXX:XX:XX.XXXZ

NOTE:
  • XX:XX:XX or XX:XX:XX.XXX symbol stands for the variable time you key in.
  • Above information is only applicable for SF latest Data Loader 
  • The "T" appears literally in the string, to indicate the beginning of the time element, as specified in ISO 8601.
  • "Z" is a special GMT designator.

No comments:

Post a Comment