Check if date is still valid

Hello I have a date string if format “13.4.2033”. can somebody pls write me a regex that return true if this string is in the future of current date.

You can do this without regex, if you convert both dates into date time type variables you can use an IF statement like if date1 >= date2

grafik

DateTime.ParseExact("13.4.2033","dd.M.yyyy", System.Globalization.CultureInfo.InvariantCulture).Date > now.Date

maybe also the days will be in the 1 digit format, then we use: d.M.yyyy

how do I convert both string into dates?

refer to the post above:

Hi @tomaz

your DateTime value is stored in a new_date which is format “dd/MM/yyyy” then use this expression in below

Date.TryParseExact(new_date.ToString.SubString(0,10),“dd/MM/yyyy”,Nothing,Globalization.DateTimeStyles.None,Nothing)

The output returns true or false.

Regards,
Kaviyarasu N

How can I make a idiot proof sistem that would recognize date “1.1.3000” and “13.4.2024” and “13.11.2025” and “1.12.2025” because I get this error:

“message”: "System.FormatException: String ‘1.1.3000’ was not recognized as a valid DateTime.\r\n at System.DateTime.ParseExact(String s, String format, IFormatProvider provider)\r\n

maybe you are looking for this:

Also have a look on how we handle multiple formats in one go:

I get an Error running this:



ensure when copy and paste snippets that double quote is this one: " and not “