How To Convert TimeStamp To 12/24hrs Format In UiPath

Different processes may demand different DateTime format based on their standards.

Let’s see how to do that…

1.DateTime in 12-hour format
2.DateTime in 24-hour format


1.DateTime in 12-hour format

Now.ToString(“h:mm:ss tt”)

Where,

  • Now = Gives Current Date and Time
  • ToString(“h:mm:ss tt”) = Converts the Current Date and Time to 12 hours format

Implementation using UiPath :

Drag a “Message box” activity into the design panel and type the above code.

UiPath Date 12 hours format


2.DateTime in 24-hour format

Now.ToString(“HH:mm:ss tt”)

Where,

  • Now = Gives Current Date and Time
  • ToString(“HH:mm:ss tt”) = Converts the string to 24 hours format

Implementation using UiPath :

Drag a “Message box” activity into the design panel and type the above code.

UiPath Date 24 hours format

Click here to download the Source Code…

Hope it has helped you… 

Advertisements

Author: Sharath Raju

Founder@www.ExcelCult.com

Leave a Reply