Hi guys,
I learnt from other post on the following expression to compare if Date2 is more than Date1 plus 1 year time:
Date1.AddYears(1)<Date2
Can anyone kindly share with me if I wanted to compare Date2 is more than Date1 plus 30 days, how should I draft the expression?
At first I thought it is something like: Date1.AddDays(30)<Date2
But it is not correct
PS: My Date1 and Date2 are stored in this format : 09-OCT-2019
Thanks!
Use this
DateDiff(DateInterval.Day,DateTime.ParseExact(str_Date, “dd-MMM-yyyy”, CultureInfo.InvariantCulture),DateTime.now())
Thanks. I actually intend to write an expression into my IF condition such as:
If Date1.AddDays(30) <= Date2
then …
In this case, Could advise me on the way to write expression?
1 Like
are you reading from the datatable?
Date1 read from data table (extracted from Excel)
Date2 read from system date (aligned the format with Date1)
sarathi125
(Parthasarathi)
6
Hi,
Try something like this,
DateDiff(DateInterval.Day, DateTime.ParseExact(date1, “dd-MMM-yyyy”, System.Globalization.CultureInfo.InvariantCulture),DateTime.ParseExact(date2, “dd-MMM-yyyy”, System.Globalization.CultureInfo.InvariantCulture)) < 30
Here my date1 and date2 are string datatype variables which holds date values.
Have to import System.Globalization namespace in UiPath Imports section to use CultureInfo.
system
(system)
Closed
7
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.