Date and Time format for extracted value

Hi everyone,

Please help me find a solution for this problem.

I extract from a website this value which is date but with a strange format (dd-MM-yyyy) :
image

I need to format this date and compare it in a if activity with the “today” date minus 60 days.

I managed to find a solution with the today date minus 60 (
image
) but when I put the extracted value in a If statement something isn’t working.

image

Please help me,
Paul

Hi @paul.baltag1

Assuming your date is always in the same dd-MM-yyyy format, you can convert your string to a System.DateTime variable dateCellValueExtracted using an assign

dateCellValueExtracted = date.ParseExact(CellValueExtracted, “dd-MM-yyyy”, system.Globalization.CultureInfo.CurrentCulture)

and from there you can use it in your if statement:

if dateCellValueExtracted > Today.AddDays(-60)

as they are now of the same type and comparison is allowed.

Hope this helps!
Happy automation!

@paul.baltag1
Use this condition inside if
(Date.ParseExact(cellValueExtracted, “dd/MM/yyyy”, System.Globalization.DateTimeFormatInfo.InvariantInfo))>(Date.ParseExact(DateI60, “dd/MM/yyyy”,
System.Globalization.DateTimeFormatInfo.InvariantInfo))

Hi,

Can you try the following condition?

image

DateTime.ParseExact(CellValueExtracted.Trim,"dd-MM-yyyy",System.Globalization.CultureInfo.InvariantCulture)>Today.AddDays(-60)

Regards,

HI @paul.baltag1

Can you try like this in the If activity

DateTime.ParseExact(Extracted.Trim,"dd-MM-yyyy",System.Globalization.CultureInfo.InvariantCulture).Tostring("dd/MM/yyyy")>DateTime. Now.AddDays(-60).ToString("dd/MM/yyyy")

Regards
Gokul

Extract date from a date and time
Formula 1: =INT(B3)
Formula 2: =TRUNC(B3)
=INT(number)
=TRUNC(number, [num_digits])
=TRUNC(B3)

Regards,
Will

Thank you very much. It works

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