I hve a column having date as 30-Jun-20. this column has different date formats. I need to check if the date given is in the format listed below:
The valid values are the following: 'DDMMYYYY' , 'MMDDYYYY' , 'YYYYMMDD' , 'DD-MM-YYYY' , 'MM-DD-YYYY' , 'YYYY-MM-DD' , 'DD.MM.YYYY' , 'MM.DD.YYYY' , 'YYYY.MM.DD' , 'DD/MM/YYYY' , 'MM/DD/YYYY' , 'YYYY/MM/DD' , 'YYYY-MM-DDThh:mm:ss.000000000' , if not than flag as "Not Valid" else "Valid" |
Please help.
Solved! Go to Solution.
Hi @SamSurya you can do this with Regex match and also check that the date dosent exceed 12 months or the date go past 31 days. Let me know what you think?
Amazing..... I was not sure if DateTime Parse would work here ..... thanks ... for showing me new way. this works ... 🙂
Wow... Thanks a tonne... This works for me and yes, you gave me a thought, I do get data where dates are in valid format but not correct this check would indeed be really helpful. so is this possible with in Regex or do we need to have additional formula.
Joseph -
Love your solution.
Thanks for another great example of the power of Regular Expressions!
Hi Joseph,
just one more help, could you please help me understanding ""^(19|20)\d\d[- /.](0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])$" .
Thanks
Sam
Yeah.. indeed... I second that