Datediff question

Hello,
i need to use datediff to check if my string variable(format dd-MM-yyyy) is more than 8 weeks between actual date.
How can i achieve that?

1 Like

Hi

Hope this expression would help you validate whether it is more than 8 weeks between actual date

Use this expression in a IF activity

Datetime.ParseExact(strinput.ToString.Trim,”dd-MM-yyyy”, System.Globalization.CultureInfo.InvariantCulture) > DateTime.Now.AddDays(-56)

Where 56 is 8*7

We don’t have AddWeeks like AddDays
Based on true or false it goes to then or else block

Cheers @legiw18734

1 Like

Hi,

Another solution:

(Now - DateTime.ParseExact(yourDateString,"dd-MM-yyyy",System.Globalization.CultureInfo.InvariantCulture)).TotalDays>56

Regards,

String was not recognized as a valid datetime, i need first to convert my string to datetime?

1 Like

Fine

May I know what is the DateTime format you have in string variable

@legiw18734

Oh sorry I saw as /
It’s - between the date and month

This updates expression will work for sure

Cheers @legiw18734

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