Date format compatibility

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

Answer

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.

Attribution
Source : Link , Question Author : Testing_SFDC , Answer Author : Community

Leave a Comment