Latest Date in datatable with different format

Hi
Iam extracting the data table from the web Outlook Inbox… I need the latest email to read… As we have a different date and time format…

Find the Below Screenshot for your reference

@katta_nikhil

Hi,

  1. Use the “Get Outlook Mail Messages” activity to retrieve the emails from the Outlook inbox. Configure the activity by specifying the necessary parameters, such as the folder to search, the maximum number of messages to retrieve, and any filtering criteria.
  2. After retrieving the emails, you will have a data table containing the email details. To identify the latest email, you need to find the email with the highest date and time value. You can achieve this by using the following steps:a. Use the “Sort Data Table” activity to sort the data table based on the “Date” or “ReceivedTime” column. Make sure to set the “Order” property to “Descending” so that the latest email appears at the top.b. Once the data table is sorted, you can retrieve the latest email by accessing the first row of the data table using the “DataTable.Rows(0)” syntax. Assign this row to a variable, let’s say “latestEmailRow”.
  3. To read the content of the latest email, you can extract specific information such as the subject, body, sender, etc., from the “latestEmailRow” variable. For example, to get the subject, you can use “latestEmailRow(“Subject”).ToString()” and store it in a variable.

Hope it works

can we have any query for this

The DateTime.ParseExact method will accept multiple formats (in an array) and use the first one that matches.

Use Add Data Row to create a third column as a datetime.

For Each Row in Datatable

  • Assign third column = DateTime.ParseExact(CurrentRow(“Column2”).ToString,{“h:mm tt”,“ddd M/d”},System.Globalization.CultureInfo.InvariantCulture)

Now you have the proper datetime value in the third column and can sort it with Sort Data Table. Then just take the first row, for example ExtractDataTable.Rows(0)(“Column1”).ToString will give you the Column1 value from the first row.

He’s talking about using the email activities. Typically you don’t use Extract to get emails from Outlook. You use Get Outlook Mail Messages.

https://docs.uipath.com/activities/other/latest/productivity/get-outlook-mail-messages

can u explain the stepwise