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) :
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 (
) but when I put the extracted value in a If statement something isn’t working.
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))
Yoichi
(Yoichi)
November 29, 2022, 11:41pm
6
Hi,
Can you try the following condition?
DateTime.ParseExact(CellValueExtracted.Trim,"dd-MM-yyyy",System.Globalization.CultureInfo.InvariantCulture)>Today.AddDays(-60)
Regards,
Gokul001
(Gokul Balaji)
November 30, 2022, 4:34am
7
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
system
(system)
Closed
December 3, 2022, 11:29am
10
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.