You need to sign in to do that
Don't have an account?

DateTime.parse () help
I have a date time string from external system that is represented as 10/13/2011 10:36:07 AM
Need to put it in datetime field on sf object. when try to do datetime.parse ('10/13/2011 10:36:07 AM'); it gives me type exception, invalid date time... any workarounds?
If you remove the seconds from the time and use
datetime.parse ('10/13/2011 10:36 AM');
instead, it works.
I also noticed that our documentation for datetime.parse is pretty lacking. That will be corrected soon.
Thanks for pointing this out.
All Answers
If you remove the seconds from the time and use
datetime.parse ('10/13/2011 10:36 AM');
instead, it works.
I also noticed that our documentation for datetime.parse is pretty lacking. That will be corrected soon.
Thanks for pointing this out.
on a side note- why is the person who replied marks answer as solved? shouldnt that be up to me to decide?
thanks.
The workaround would be to parse the string and strip out the seconds.
It looks like as of api v45 salesforce added feature of a comma after the date string.
https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_datetime.htm#apex_System_Datetime_parse