How to read a e-mail between dates and time?

I need to read the mails of yesterday with time. User will give from date(18/04/2022 00:00:00 AM) and to date(19/04/2022 09:00:00 PM)and round 2 (19/04/2022 09:00:00-15.00PM). Can i do this in UiPath?

This my Code But Output is Incorrect Please Help.
“[Received] >= '” + DateTime.Today.AddDays(-BackDate).ToString(“dd/MM/yyyy”) + " 00:00AM’ AND [Received] <= ‘"+ DateTime.Today.ToString(“dd/MM/yyyy”) + " 09:00PM’"

Thank you.

try with a space before AM and PM
“[Received] >= '” + DateTime.Today.AddDays(-BackDate).ToString(“dd/MM/yyyy”) + " 00:00 AM’ AND [Received] <= ‘“+ DateTime.Today.ToString(“dd/MM/yyyy”) + " 09:00 PM’”

I try a spece and run again output incorrect

“[Received] >= '” + DateTime.Today.AddDays(-BackDate).ToString(“dd/MM/yyyy”) + " 00:00 AM’ AND [Received] <= ‘“+ DateTime.Today.ToString(“dd/MM/yyyy”) + " 09:00 PM’”

Hi,

Can you try to use ToString(“d”) instead of ToString(“dd/MM/yyyy”) as the following?

"[Received] >= '" + DateTime.Today.AddDays(-1*BackDate).ToString("d") + " 00:00AM' AND [Received] <= '"+ DateTime.Today.ToString("d") + " 09:00PM'"

Regards,

1 Like

Hi
i try this and run again output incorrect output is get time : 09.27 PM and 10.18 PM

“[Received] >= '” + DateTime.Today.AddDays(-1*BackDate).ToString(“d”) + " 00:00 AM’ AND [Received] <= ‘"+ DateTime.Today.ToString(“d”) + " 09:00 PM’"

image

Hi,

It’s not 9 p.m. yet today. Received date of the email is yesterday or before, isn’t it?

Regards,

1 Like

Oh my god i am so sorry i mean 09.00 AM

So Sorry This is Correct ^^

Thank you

2 Likes

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