Date compare

Hi all,
i’m doing a GET TEXT and my result is a date in this format 20/10/2024 and i need to compare with a fixed date and check if is greater than or not. I’ll try mantain generic value or string but doesn’t work. How can i do that?
Thx in advance

Assign the date string to a new DateTime using DateTime.Parse(“yourdatestring”) or DateTime.ParseExact(“dd/MM/yyyy”, “yourdatestring”) and then compare to your fixed date.

1 Like

I’ll try but i can’t do that.
I’ll try with this (to manage also day and month d/m/yyyy) with the following expression:

DateTime.ParseExact(date2, @“d/M/yyyy”, System.Globalization.CultureInfo.InvariantCulture)
Where date2 is a string value


DateTime.ParseExact(“dd/MM/yyyy”, date2)
But in this case return an error "compiler error encountered processing expression "

convert your date with
Convert.ToDateTime(date1).ToShortDateString and check pls

If i put that in assign
DATETIMEVAR = Convert.ToDateTime(date1).ToShortDateString
the error is “cannot assign from type system.string to type system.datetime in assign activity”

DATETIMEVAR should be string dude.

ShortDateString will give date in one of the proper format

other way is


1 Like

Oh, sorry, i’m confused about that.
if DATETIMEVAR is a string in the if condition i’ll do DATE1(string) < DATE2(string)?

And, if date1 is a DATETIME TYPE, how can i pass the value? Because if i initialize a variable of type DATETIME with 31/02/2020 for ex. respond the error “Conversion from double to date request Date.FromOADate”

@yiroday We won’t get the Expected Output if you are Comparing Strings in that way, You can only perform operations such as Contains, substring not less than , greater than operations when using a String as Variabe

1 Like

So i need two DateTime Variable if i want to do greater than? but if i have two string variable (“31/12/2020” & “20/12/2018” for example) how can i convert that?

convert both string to date format and then compare .

In my case , i suggested to frame a date as string format for better understanding

use this on both side of string and compare


1 Like

@yiroday Use this :

1 Like

Thanks to both for your answers.

I’ve found also another solution, i don’t know very well which is the difference but it work.

DateTimeVariable = CDATE(YourStringVariable)

1 Like

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