How to check and extract the most recent date and time

Hi ,

I have a table which contains 3 different date and time. I need to take the most recent time from that table. How to get that recent date. This is the below snapshot
image

Thanks,
Sneha

Hi,

  1. Convert your strings to DateTime format and put them in an array or a list.
  2. Create a variable representing your most recent date.
  3. Use For Each to loop through your DateTime values.
  4. If the current DateTime value is more recent than your most-recent-date-variable, assign its value to your most-recent-date-variable.
  5. Done! You looked at all your DateTime values and received your most-recent-date-value in your variable.

Cheers, Lukas

1 Like

Thankyou so much…Let you know if any doubt…

Hey ,

Can you give me a code snippet for point 4 I am not getting Properly.

Thanks,
Sneha

Okay, sure.

This part is very simple. Once you have the date in the proper DateTime format you can just use operators like “>” or “<” to compare dates.

CompareDate.xaml (5.4 KB)

Another way would be to use the Compare dates activity in the Workflow Manager Package as described here Comparing dates - earlier/later. The tricky part is always parsing the string to DateTime correctly. There are several posts about it in this thread too :wink:

Let me know, if this helps.
Cheers, Lukas

1 Like

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