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

How can I check if a given string is a DateTime String?
I want to ask if there is a method in Salesforce for checking if a given string is a DateTime format string?
You need to sign in to do that
Don't have an account?
Date.ValueOf() does not accept null value as its input parameter.
The format of the String depends on the local date format.Try giving date in the format yyyy-mm-dd. It should work.
Example :
String abc = '03/03/1990';
System.debug('Gm '+ date.parse(abc));
To check string ,
Date d = String.isBlank(str) ? null : Date.valueOf(str);
More info : https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_methods_system_date.htm