Skip to main content

Hi All,

toDate(Input, “yyyy/MM/dd”) function is not throwing null when I am passing value “1/1/1”. Input datatype is string.

can anybody help why it takes 1/1/1 as valid date value?

Regards,
Shefhali

Also, Is there any function or method available to validate a date which datatype is string?


Hi ​@Shefhali singh,

“1/1/1” under this format is read as “1st January 0001 AD”, which is a valid date, Monday.
You might want to add an additional rules, to validate that the resulting date falls within certain range, e.g. no older than a hundred years from now.


Thank you team, i have added some other regexp to handle these special cases that I want to fail


Reply