How to check whether date in excel cell has been more than 60 days?

i have an excel table with two column,the second column has rows of dates, i want to know how to determine whether each date has been more than 60 days? i am new uipath and i would like to get some help, thank you :slight_smile:

1 Like

Hi
Welcome to uipath community
If possible can we have a screenshot of sample data in the excel
So that we could go in a right direction to solve this

Cheers @Yusuf_Rahmaniac

1 Like

Capture

hi sir thanks for your reply. hereby attached the sample photo… i just want to determine whether the dates has been more than 2 months from todays date,

@Yusuf_Rahmaniac
You can try with the following flow
TestDate.xaml (7.1 KB)

The idea is that you will add 2 months to the excel date and if the date is smaller than the now date, then 2 months have passed.

I’ve made this flow without testing it, so you might have errors because of the input.
If you need further help, just send me a test file with the dates

1 Like

@Yusuf_Rahmaniac simply add addMonths Property

date=System.DateTime.Now.AddMonths(2)

1 Like

Hi,

The attached workflow accepts a date as an argument and returns a text as an output.
For test purpose the input argument is set with default value as “01/01/2019” and the workflow returns the result “earlier than two months ago”. This is not a complete solution but it will provide you with an overall concept of date comparison. For a robust solution you need to take several possible exception into account. For example first try to parse the input argument to check whether the format is correct or not…
DateComparator.xaml (8.6 KB)

Regards

1 Like

hi sir thank you for your reply. here is a sample of the excel table. i just want to know whether the end date has been more than 2 months. :smile: Capture

1 Like

Hi @Yusuf_Rahmaniac

Set the condition as row("end date). ToString.equals(now.ToString.AddDays(1). ToString or conditions
Check this
Thanks
Ashwin.S

1 Like

Fine
—hope this would help you
—use excel application scope and pass the file path as input
—then use a read range activity and get the output with a variable of type datatable named outdt
—now use a for each row loop and pass the above variable Outdt as input
—inside the loop use a if condition with condition like this
DateTime.ParseExact(row(“Yourcolumnnameof EndDate”).ToString.Substring(0,10),”dd/MM/yyyy”,System.Globalization.CultureInfo.InvariantCulture) > Now.AddMonths(-2)

Or if this shows any error like stri gbis not recognised as valid DateTime then we need to check with the format of the column value
—so use a write line activity inside the for each row loop mentioning the input as
row(“yourcolumnnameofEndDate”).ToString
This will print us the value of date from that excel column
—so based on that we need to mention the format here in ParseExact method, here in the highlighted area
DateTime.ParseExact(row(“Yourcolumnnameof EndDate”).ToString.Substring(0,10),”dd/MM/yyyy”,System.Globalization.CultureInfo.InvariantCulture) > Now.AddMonths(-2)

Here I have used SubString to get only the format of “dd/MM/yyyy” which is 10 character letter so
Substring(0,10) was used

Simple isn’t it
Kindly try this and let know for any queries or clarification
You were almost done
Cheers @Yusuf_Rahmaniac

3 Likes

hi sir, this works perfect. thank you for your help !!

thank you sir

thank you for your help!!

1 Like

thank you sir for your help!!

1 Like

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