2

I am trying to insert date from csv file into Salesforce (Sandbox for now).

I have a csv file that has this format YYYY-MM-DD hh:mm:ss.

Bottom is screenshot from a csv file.

enter image description here

I tried inserting into a custom field of Date and DateTime data formats.

When I ran Python file to insert data (using Linux), I am getting same error on both occasions (Date or DateTime).

'JSON_PARSER_ERROR' Cannot deserizlize instance of date from VALUE_STRING.

This is not System.JSONException error.

enter image description here

Is this something to be fixed on the format of csv file?

I read other cases, and it mentioned something about standard ISO 8601 format, but I am trying to go with simple YYYY-MM-DD hh:mm:ss format.

3
  • I need to have hh:mm:ss format, and I do not have quotes nor trailing comma.
    – Java
    Aug 4, 2017 at 18:45
  • It looks like you may be trying to put the data into a Date field and not a date time
    – Eric
    Aug 4, 2017 at 18:53
  • I tried both Date and DateTime field, and same error message.
    – Java
    Aug 4, 2017 at 18:56

1 Answer 1

1

You must use one of the following formats for json to be able to parse. Leave the 'T' and 'Z' characters as they are.

YYYY-MM-DD YYYY-MM-DDThh:mm:ss+hh:mm YYYY-MM-DDThh:mm:ss-hh:mm YYYY-MM-DDThh:mm:ssZ

EG: 2047-07-24T10:28:00+00:00

I'd open with excel and use a combination of left, right and concatenate functions until the formatting was correct, and then save as values and try loading again.

2
  • I am trying to not open csv file in Excel, but leave as it is. Also, since I am trying to insert into Date or DateTime data format, shouldn't I use the format listed in help.salesforce.com/…
    – Java
    Aug 5, 2017 at 14:43
  • I found the solution. I need to use either of these formats to work. • YYYY-MM-DDThh:mm:ssZ • YYYY-MM-DDThh:mm:ss.sssZ
    – Java
    Aug 7, 2017 at 18:28

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