Check if date its same or later

Hi! I want to make a function that checks if a certaint date its the same or later as another date.

Any ideas?

@langsem

Use Compare Date activity to compare two dates. Please check below thread for your reference.

But that only finds exact date?

@langsem

It will compare two dates and provide output as below.

If result is 0, both dates are same. If result is less than 0, the first DateTime is earlier; otherwise the first DateTime is later

ok, getting a error cant convert from string to date

@langsem

First you need to convert that string to date and then pass it to that activity. The below method will convert String to date.

      CDate("inputStrDate")

Assign: Conversion from string “25.02.2020” to type ‘Date’ is not valid.

@langsem

Show me what expression you are using in Assign activity.

the thing i am trying to do its that i have a date from a pdf file formated 00.00.0000 then i check in app for another date formatted the same way. Then i want to check if that date its the same or later. If thats the case then its correct else move to next row and check for next date. made the row function etc work but the dateformatting its the problem

@langsem

Please check below thread and try.

hm could it be that my date format its 00.00.0000 ?

tried different solutions now, but non works still getting the errors

Convert date and time: String was not recognized as a valid DateTime.
Assign: String was not recognized as a valid DateTime.

Hi @langsem,

You can try converting you date with this:

DateTime.ParseExact(YourStringDate,“dd.MM.yyyy”,System.Globalization.CultureInfo.CurrentUICulture.DateTimeFormat)

Thanks for the advice, but manage to make it work on my own :slight_smile:

2 Likes