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

Format received:

29-JUL-13 PM

SFDC supported Format:


1 Answer 1


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:


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.

  • Hi Uwe! Yes I do my loading by dataloader. Sep 3, 2014 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, 2014 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, 2014 at 18:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .