You need to sign in to do that
Don't have an account?
divya gourigari 14
Datetime.parse() fail in Apex Controller
The failing line is like Datetime.parse('3-31-2022 12:00 AM')
The exception is:
System.TypeException: Invalid date/time: 3-31-2022 12:00 AM
However, if I run this line below in anonymous Apex in dev console, there is no exception.
System.debug('parse'+Datetime.parse('3-31-2022 12:00 AM'));
The exception is:
System.TypeException: Invalid date/time: 3-31-2022 12:00 AM
However, if I run this line below in anonymous Apex in dev console, there is no exception.
System.debug('parse'+Datetime.parse('3-31-2022 12:00 AM'));
EDITED:
Can you try See related: https://salesforce.stackexchange.com/questions/320854/how-to-convert-datetime-in-gmt-when-input-format-contains-am-pm
https://salesforce.stackexchange.com/questions/247210/system-typeexception-invalid-date-time-2019-01-03t002601-711-0200
If this information helps, please mark the answer as best. Thank you
Thank you for response, i have tried above format but still getting same error.