✅ How to Print the Current Date in UiPath (With Example)
🟦 Step 1: Create a Variable
In the workflow, a variable named name
is created to store the current date.
Variable Name:
name
Variable Type:
DateTime
Scope: Main (or as required)
You can create it in two ways:
Through the Variables panel, or
Press
Ctrl + K
in the Assign activity and enter the variable name.
🟦 Step 2: Assign Today’s Date
Use the Assign activity:
To:
name
Value:
Now()
This assigns the current system date and time to the variable.
✔️ Now the variable name
holds something like:10/11/2025 17:32:10
🟦 Step 3: Display the Date in Short Format
Use a Log Message activity to print the date.
Message:
name.ToShortDateString
This converts the DateTime value to a readable short date such as:10/11/2025
Log Level: Info
✅ Output
When you run the workflow in Debug mode, you’ll see something like this in the Output panel:
test execution started
10/11/2025
test execution ended in: 00:00:01
Your Log Message prints only the formatted date, just as shown in the image.
🟦 Why Use ToShortDateString
?
Methods like ToShortDateString
ensure you display only the date part without the time.
Here are a few useful alternatives:
Method | Output Example |
---|---|
ToString("dd-MM-yyyy") | 11-10-2025 |
ToLongDateString | Saturday, 11 October 2025 |
ToShortDateString | 10/11/2025 |
✅ Summary
Using a variable with Now()
and a simple Log Message, you can easily print the current date in any UiPath workflow. The image clearly shows:
Assign →
name = Now()
Log Message →
name.ToShortDateString
Perfect for logging, reporting, or timestamping automations!
Let me know if you’d like this turned into a Markdown post or published style content!
