Check if date (with different format) is more than 6 months


I have a business requirement where i need to check whether date is more than 3 months or not.

So, there is a webpage from where i will get the date details, i need to fetch every date one by one and check if its more than 3 months or not.

Issue is that date format different sometimes.
Sometimes it shows Unknown.

Please see the below screenshots for your reference.

How will I check these dates and verify if its more than 3 months or not.

Please suggest on this one.

Have you tried DateTime.Parse()

For more info, DateTime.Parse Method (System) | Microsoft Learn

Can you please elaborate more on this and how will I use this ?

as you can see the date can appear as for exp, May 12, 2019 or yesterday or today something like that.

So need to know how will i use this here ?


Check below post

Hope this helps


Say the date format is different when the date is:

  1. Unknown
  2. Yesterday
  3. ANy others?

If the exceptions are only the 2 above, then you can skip or set a date value for those to compare in your code. for example if contains yesterday, then Date= DateTime.Now.AddDays(-1).tostring(“format”).

1 Like

Tried with Regex and if Condition.

dates.xaml (7.0 KB)