Problem comparing dates

Hi,

I have a dymaic date that I’m struggelign to compare to another date.

I’m using the get text function to get the date that is 20.02.2024. Then I want to know if that is older than 7 days. If it’s older then seven days then I want to do write a message older than 7 days.

@Kquick

isOlderThan7Days = DateTime.ParseExact(yourDateString, "dd.MM.yyyy", System.Globalization.CultureInfo.InvariantCulture) < DateTime.Now.AddDays(-7)

@Kquick
Welcome to the forum

We would parse the string into a datetime variable and check within an if activity

We suggest to baseline the Date with appended Date Property retrieval:
grafik

Hi @Kquick

Try the below

Assign: 
    extractedDateTime = DateTime.ParseExact(YourGetTextFunction(), "dd.MM.yyyy", CultureInfo.InvariantCulture)
    difference = DateTime.Now.Subtract(extractedDateTime).TotalDays
If: 
    difference > 7
Then: 
    Write Line or Log Message: "older than 7 days"

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