1

I am using data loader to export salesforce data to csv format. In the csv file all the date and time fields are coming as like '2017-03-08T06:18:46.000Z'. Is there any way to change the format like 'YYYY-MM-DD' or 'YYYY-MM-DD HH:MI:SS' format?

1

Salesforce stores the date in UTC with that format. What you are seeing is what SFDC actually has in the database. This means that it is not only in the wrong format, but probably the wrong time zone. Dataloader doesn't have an option to change the format or timezone of the field when you retrieve it from the database.

I'd recommend running it as a report in SF and export the report which should show it in an easier to read format in your own time zone.

If you don't care about the timezone, I believe Excel (and probably most spreadsheet systems, Google Sheets does as well) has a way to format the date. If you have access to Excel set the field type to date and using the built in formatting strings to get the format you want.

0

I believe what you are looking for is SOQL's FORMAT() function, which can format your datetime fields based on your user's locale settings. (Available as of Spring '16, api version 36.0)

Sample query using the bulk api:

SELECT FORMAT(CreatedDate) FROM Account LIMIT 10

Results:

  1 "CreatedDate"
  2 "2015-8-25 下午4:54"
  3 "2015-8-27 上午8:57"
  4 "2016-12-19 上午9:18"
  5 "2015-8-25 下午4:51"
  6 "2015-8-26 上午9:01"
  7 "2017-2-13 上午9:48"
  8 "2015-8-25 下午4:57"
  9 "2015-8-25 下午5:00"
 10 "2015-8-31 上午9:24"
 11 "2015-8-31 上午10:02"
0

This 2017-03-08T06:18:46.000Z is a default format when you export through dataloader.

You can create formula field and specify your desired date format and export the field data.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.