I want to know a syntax for fetching date from mail and converting to System date format

After converting the Mail date to System date. I want to validate, if there is any mail in mail box with today’s system date.

Please find the sample workflow’s attachment .

Thanks in advance.

1 Like

Hi @Samuel_Sugur1

Check this

Ashwin S

I’m new to uipath.

The syntax i’m trying to use is like item.header(“Date”).Contains()

Hi @AshwinS2, I have already looked into this statement. Not getting the syntax. My query( I want to fetch the date from Email and convert to (“dd/MM/yyyy”) date fromat and then compare the email date and System date.)

@Samuel_Sugur1 Can you tell me What is the format of Email Date?

Please find the attachment


@Samuel_Sugur1 Is that the format of Date after you extract from the Email or In the Email itsefl?

Yes. When i fetch the date from Email.

@Samuel_Sugur1 Do you want the time or only the Date ?

Only date.

Hi @Samuel_Sugur1

try this

DateTime.ParseExact(row("columnname ").ToString,“(“dddd, dd MMMM yyyy”)”, System.Globalization.CultureInfo.InvariantCulture).ToString(“MM/dd/yyyy”)

Ashwin S

Hi @AshwinS2, i’m not understanding the the syntax which you have pinged. Please find in my initial attachment. In IF condition i have added validation like item.subject.Contains(“hostname”) And item.Body.Contains() And One more I want is to validate the mail date with Systemdate. (Reason to fetch the mail body according to today’s date containing same Subject name, keyword in body).

Hi @AshwinS2 , i tried using syntax in this format. Please check.

@Samuel_Sugur1 Can you Try this and Check :

  1. Assign strArray = Split(yourExtractedDateVar.Trim)
  2. Assign tempDate = String.Join(" ",strArray(0),strArray(1),strArray(2),strArray(3))
  3. Assign strDate = Datetime.ParseExact(tempDate.Trim,“ddd, dd MMM yyyy”,System.Globalization.CultureInfo.InvariantCulture).ToString(“dd/MM/yyyy”)

Hi @supermanPunch , Can you tell me what data type should i use for the above given 3 variable?

@Samuel_Sugur1 strArray is Array Of String, tempDate is String, strDate is String

Hi , trying to fetch date from mail using item.Header(“Date”) ,the output comes in the format of Thu 02/27/2020 8:00am and I want to convert the mail date format to System date format i.e 02/27/2020

Please help.

@Samuel_Sugur1 Did the Format Change? :sweat_smile: Last time you had shown us it had +0300 as well

Yes. I tried the syntax which you have suggested still no expected output.

@Samuel_Sugur1 Have you created a workflow for it ?