Please, how can I retrieve the arrival date of an email

Please, how can I retrieve the arrival date of an email?
Thanks

Hi @Etshindo,

Have you tried the solution from this thread?

Hello @Etshindo,

You can do that by this method,
mail.Headers(“Date”)

Hi,

Thank you.

I am receiving the date in the format “Fri, 13 Nov 2020 11:05:41 - 0200”.
Please, what can I do to arrive in “DD/MM/YYYY” format

Thanks in advance,

Hi @Etshindo what is the number after - ?

I didn’t understand that part and also need to know whether that number comes with all dates ?

@Etshindo

Try as below

https://forum.uipath.com/t/convert-date-time-format-tutorial/242670/2

Hope this helps you

Thanks

Hi Sirniva,

I don’t know what that number is. But it is coming in this format that I sent. I just executed it now and the following appeared:
Fri, 13 Nov 2020 11:08:59 -0200

Try This
CDate(mail.Headers(“Date”)).ToShortdatestring u will the output as 14/11/2020

Hi @Etshindo check this way

Use assign activitiy like this

input_date = Split(mail.Headers(“Date”),‘-’)(0)

output_date1=DateTime.ParseExact(input_date, “ddd, dd MMM yyyy hh:mm:ss” , System.Globalization.CultureInfo.InvariantCulture).ToString(“dd/MM/yyyy”)

Check this and try this way

Hope it helps :blush:

Regards

Nived N :robot:

Happy Automation :relaxed::relaxed::relaxed:

I would like to extend the answer of @vamsiyeluri

You may convert a variable of DateTime type to whatever format you want, using this
CDate(mail.Headers(“Date”)).ToString(“dd/MM/yyyy”)
CDate(mail.Headers(“Date”)).ToString(“MM/dd/yyyy”)
CDate(mail.Headers(“Date”)).ToString(“dd.MM.yyyy”)
CDate(mail.Headers(“Date”)).ToString(“yyyyMMdd”)

etc

Hello @NIVID N

Unfortunately the DateTime.ParseExact command (input_date, “ddd, dd MMM yyyy hh: mm: ss”, System.Globalization.CultureInfo.InvariantCulture) .ToString (“dd / MM / yyyy”)
return a conversion error: “String was not recognized as a valid Date Time”

But I thank you very much.

I used the tip from @Yurii Horobets, that is CDate (mail.Headers (“Date”)). ToString (“dd / MM / yyyy”)
and it worked perfectly.
thank you @Yurii Horobets

Hi @Yurii Horobets

I used the CDate (mail.Headers (“Date”)). ToString (“dd / MM / yyyy”)
and it worked perfectly.

Thank you.

Regards

Cool!
Please mark that as a solution )

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