Date operations Question

Hello everyone,

I write to an excel the date of today using : Now.ToString(“d.MM.yyyy”) , after some time I need to check how many days passed after my last writing of the date so actually I need something like:

read cell and output as “date” ,
if
date - Now.ToString(“d.MM.yyyy”) = 3 do . . . . . . . . .

else
do this.

How can I do “” date - Now.ToString(“d.MM.yyyy”) = 3 “”

ty.

edit:: so format of the date is like 15.03.2020

Sorry for late reply:

Use assign value :
daysvalue type should be double

daysvalue=(Convert.ToDateTime(sdate) - datetime.Now.ToString(“dd-MM-yy”)).TotalDays

after run this above command, you will get days

Let me know if any issue
Happy Automation!

Regards
Sagar

1 Like

In sdate you will get value from your excel

This is a classy solution. Thank you for sharing @Sagar_Gupta1

Mark as solution if it work

1 Like

If it were my post, I would :slight_smile:

DateDiff(DateInterval.Day, DateTime.ParseExact(ExampleDate, "dd.MM.yyyy", System.Globalization.CultureInfo.InvariantCulture), DateTime.Now).Tostring

I have actually managed to make it work with this code.
Ty anyways :slight_smile:

1 Like

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