Compare Text String from a DataExtractTable on the Web to today's date

Hello Uipath Community,
I really need your help to finalize a condition I try to implement in my project.
image
I have, on a website, a range with dates as a string format: 2021-11-04 00:38:46 ==> Meaning the associated report was updated on Nov 4th at 00:38am.

I need to build a condition saying that if this string = today’s date, so the robot can click on the associated report.

Can you help me? I guess I will have to extract each part of the string (year-month-day) to recreate a date then compare it to today but I’m a little bit lost about the How.

Thanks a lot

grafik

we can use the string for conversion into datetime and check against today

Hi

Hope the below steps would help you resolve this

  1. Use a FIND TEXT POSITION activity and mention this as input

Datetime.Now.ToString(“yyyy-MM-dd hh:mm:ss”)

And get the output as a uielement variable named out_element

  1. Then use a ANCHOR BASE activity where in left side use FIND ELEMENT activity as anchor
    Where pass out_element as input to Element property

  2. In right side of Anchor base activity use a CLICK activity which will click in that corresponding file

Cheers @MATRAY_Guilhem

Seems so easy. Thanks for your quick feedback.
I will be able to put this condition in a loop by replacing the “2021-11-04 00:38:46” by ExtractDataTable.Rows(Line).Item(column).ToString.

Seems to work! Thank you very much.

If I want to compare to yesterday date, can I just replace Today by Today-1 ?

Yeah it’s like this

Datetime.Now.AddDays(-1).ToString(“yyyy-MM-dd hh:mm:ss”)

Cheers @MATRAY_Guilhem

Thanks a lot

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