5

I have received a datetime format not supported to load in salesforce. Can someone suggest a way out here.

Format received:

29-JUL-13 01.17.05.335000000 PM

SFDC supported Format:

2014-08-18T19:27:16.000Z
3

You did not mention if you are looking for a solution for dataloader, a formula or a piece of apex code to convert the date.

So I assume you want to use apex since you have tagged the question with apex.

As of my knowledge, there is no "one-liner" to do it. I'll try to push you on the right track, but won't provide full code - but it's easy to write it.

There are a few things which might give you not a perfect solution:

Bottomline:

if you don't care about Seconds and Milliseconds, it's very easy and straight forward. If you just want to store Seconds but not Edit them using the Standard UI, it's also no problem.

3
  • Hi Uwe! Yes I do my loading by dataloader. – Testing_SFDC Sep 3 '14 at 18:43
  • 1
    for dataloader you could do something like the above but in Excel. Or - if you do any kind of import jobs more frequently - you could decide not to use dataloader and have a look at tools like TalenD: de.talend.com - there again, you will write a couple of lines to convert the string – Uwe Heim Sep 3 '14 at 18:45
  • 1
    I updated my answer because I suggested by accident the GMT version of datetime.newInstance() - but btw keep also timezones in mind, if necessary. – Uwe Heim Sep 3 '14 at 18:51

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.