I need help understanding datetime robot

Hi, I have attached a robot to this post. I don’t know what the extensions to the assign do (TryParse, ParseExact, etc). I also don’t know why there is a message box to show the time when time was not assigned to strDate variable. I tried to google but don’t really understand.

Thank you!

Date_arithmetic (1).xaml (10.4 KB)
a

tryParse - checks if string is a valid datetime, in this case the string to check is strDate(20-06-2022), it returns true if success , false if failed hence why it was used in the if statement
image

the messagebox is showing datetime_for_demo.ToLongDateString not strDate

and before the messagebox, you assigned

datetime_for_demo = DateTime.ParseExact(strDate, "dd MMM yyyy", System.Globalization.CultureInfo.InvariantCulture)

image

parseExact means you try to parse strDate into a date using the specified format (in this case “dd MM yyyy”)

Hi @Ivan17 ,

Here is quick guide to get familiar with DateTime Conversions,

HAPPY AUTOMATION !!!