Chack correctnes of dte

Hello, I have a string containing date “15. 1. 2022 - 20. 1. 2023”, I would like to check if todays date is inside of this date window.

Hi,

How about the following sample?

m=System.Text.RegularExpressions.Regex.Match(yourString,"(?<FROMDAY>\d{1,2})\D+(?<FROMMONTH>\d{1,2})\D+(?<FROMYEAR>\d{4})\D+(?<TODAY>\d{1,2})\D+(?<TOMONTH>\d{1,2})\D+(?<TOYEAR>\d{4})")

Then condition is

New DateTime(CInt(m.Groups("FROMYEAR").Value),Cint(m.Groups("FROMMONTH").Value),CInt(m.Groups("FROMDAY").Value))<now AndAlso New DateTime(CInt(m.Groups("TOYEAR").Value),Cint(m.Groups("TOMONTH").Value),CInt(m.Groups("TODAY").Value))>now

Sample20221124-1aL.zip (4.1 KB)

Regards,

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.