Datetime after specific date

Hi,
The bot acquires a specific date which is a datetime type of variable. I want to establish 2 conditions. One if the date is before 10/01/2022 and one if its after. How can I establish a comparison between 2 dates?

Thanks!

2 Likes

Hello Daniela,

I think the best way to do this is to transform your string “10/01/2022” to a dateTime variable with:

DateTime.ParseExact(“10/01/2022”,“dd/MM/yyyy”,System.Globalization.CultureInfo.InvariantCulture)

After transforming your string to Datetime, you just need to make simple IF Statements such as > or <.

For more information about transforming datetime:

If both variables are datetime you can just use the same < and > you’d use for any other comparison.

Thanks for the support!

1 Like

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