How to Initialize a Date Variable in Power Automate?

When working with dates in Power Automate, initializing a date variable is often one of the first steps you’ll need to take. Whether calculating deadlines, comparing dates, or formatting timestamps, having a date variable at the ready makes your workflows more organized and efficient.

In this Power Automate tutorial, I will show you how to initialize a date variable in Power Automate.

Also, I will show below example:

  • Initialize a Date Type Variable to Get Today’s Date – Learn how to set up a date variable to store the current date dynamically.
  • Add Days to Today’s Date – Explore calculating future or past dates by adding or subtracting days to a date variable.
  • Format a Date Variable – Understand how to format date variables to display them in different styles, such as “Weekday, Month Day, and Year.”
  • Initialize a Date Type Variable from a SharePoint List – See how to initialize a date variable with data retrieved from a SharePoint list.

Initialize a Date Variable in Power Automate

You want to create an Instant Cloud Flow where a user manually triggers the flow, provides the meeting details (such as meeting name, meeting date, and attendee email), and the flow sends a reminder email to the attendee.

To do this, follow the below steps:

1. Create an Instant Cloud Flow by selecting the ‘Manually trigger a flow’ trigger action. Then, add the following input fields:

  • Meeting Name (Text): The name of the meeting.
  • Meeting Date (Date): The date of the meeting.
  • Attendee Email (Text): The email address of the attendee.
power automate date variable

2. Add an ‘Initialize variable‘ action. Set the variable name, select ‘String’ as the type, and provide the value from the dynamic content of ‘Meeting Date.’

power automate variable date

3. Add the Send an email (V2) action to send the reminder email and provide below parameters:

  • To: Use the Attendee Email input from the trigger:
@{triggerBody()?['text_1']}
  • Subject: Reminder: Meeting – [Meeting Name]:
Reminder: Meeting - @{triggerBody()?['text']}
  • Body: Customize the body of the email with details like:
Hi,

This is a reminder that you have a meeting scheduled for @{variables('Meeting Date')}.
Meeting Name: @{triggerBody()?['text']}

Please make sure to attend the meeting on time.

Best regards,
Your Automated Reminder System
date variable power automate

Save your flow and manually trigger it using the “Run” button. Enter the meeting details (name, date, and attendee email) and check if the reminder email is sent correctly.

power automate create date variable

The flow will send an email like this:

Initialize a Date Variable in Power Automate

Initialize a Date Type Variable to Get Today’s Date in Power Automate

Follow these steps to initialize a Date-type variable in Power Automate and get today’s date. The scenario is to manually trigger a flow and initialize a variable that holds today’s date, which can be used for further logic in the flow.

1. Create an Instant Cloud Flow by selecting the ‘Manually trigger a flow’ trigger action.

power automate initialize variable date

2. Add the “Initialize Variable” action and provide below parameters:

  • Name: Set the Name to TodayDate.
  • Type: Set the Type to String.
  • Value: For the Value, use the following expression to get today’s date:
utcNow()

This expression will return today’s date in UTC format ( 2025-01-06T10:00:00Z).

initialize variable power automate

3. Add a compose action and provide the above Initialize Variable to see today’s date.

power automate create date

Save your flow. Then, manually trigger it. Once the flow runs successfully, click the ‘Compose’ action to check the output.

Initialize a Date Type Variable to Get Today’s Date in Power Automate

Add Days to Today’s Date in Power Automate

You want to create an Instant Cloud Flow where today’s date is taken, and a certain number of days (5 days) are added. Then, you can use the resulting date for further actions, like sending an email or performing other operations.

1. Create an Instant Cloud Flow by selecting the ‘Manually trigger a flow’ trigger action. Add the ‘Initialize variable’ action and provide the following parameters:

  • Name: Set the Name to TodayDate.
  • Type: Set the Type to String.
  • Value: For the Value, use the following expression to get today’s date:
utcNow()
power automate initialize variable

2. Add a “Compose” action to calculate the new date by adding days. In the Inputs of the Compose action, use the following expression to add days:

addDays(variables('TodayDate'),5)

This expression will add 5 days to today’s date. You can replace 5 with any number of days you want to add.

power automate initialize date variable

Save your flow. Then, manually trigger it. Once the flow runs successfully, click the ‘Compose’ action to check the date.

Today’s date is 2025-01-06, but in the Compose action, it shows 2025-01-11.

power automate set variable to today's date

If you want to subtract a date, provide a negative number instead of a positive one, like this:

addDays(variables('TodayDate'),-5)

Format a Date Variable in Power Automate

You want to create an Instant Cloud Flow where a date variable is initialized, formatted into a specific date format (yyyy-MM-dd), and used in further actions like sending an email or updating a record.

1. Go to Power Automate and select “Instant Flow” from the “Create” options. Choose “Manually trigger a flow” and click Create. Add the “Initialize variable” action:

  • Name: DateVariable
  • Type: String
  • Value: Set the Value to today’s date or any specific date. You can use the expression utcNow() to get the current date and time.
Format a Date Variable in Power Automate

2. Add a “Compose” action to format the initialized date. In the Inputs field of the Compose action, use the following expression to format the date variable:

formatDateTime(variables('DateVariable'), 'yyyy-MM-dd')
Add Days to Today’s Date in Power Automate

Save your flow, then manually trigger it. Once the flow runs successfully, click the ‘Compose’ action, where you should see the date in the ‘yyyy-MM-dd’ format.

power automate today's date

if you need to format a date variable, you can use the formatDateTime() and utcNow() functions. This functions allows you to specify a custom date format and applies it to the date value.

Initialize a Date Type Variable from a SharePoint List in Power Automate

You want to create a flow that reads a date value from a SharePoint list (Due Date column), initializes a Date type variable with that value, and then uses it in subsequent actions.

1. Create an Instant Cloud Flow and Add a Get items and provide the below parameters to retrieve the data:

  • Site Address: Select the SharePoint site where your list is stored.
  • List Name: Choose the name of the SharePoint list (Task Tracker).
Initialize a Date Type Variable from a SharePoint List in Power Automate

2. Add an “Initialize Variable” action and provide

  • Name: TaskDueDate (or any name you prefer)
  • Type: String
  • Value: leave it blank
Initialize a Date Type Variable from a SharePoint List Power Automate

3. Add the set variable action and select the variable name from the drop-down. Then, in the value field, select the Due Date column from the SharePoint item.

formatdatetime power automate

4. Add the “Send an email (V2)” action to send the reminder email and provide below parameters:

  • To: [Recipient Email]
  • Subject: “Task Due Date Reminder”
  • Body:
The task is due on: @{variables('TaskDueDate')}
Power Automate Initialize a Date Type Variable from a SharePoint List

You can save your flow and then manually trigger it. Once the flow runs successfully, Recipient will receive an email notification.

How to Initialize a Date Variable in Power Automate

This tutorial covered various ways to work with date variables in Power Automate. We started by learning how to initialize a date variable with today’s date using the utcNow() function, followed by adding or subtracting days to calculate future or past dates.

Next, we explored formatting date variables into specific styles using the formatDateTime() function for better readability. Finally, we learned how to initialize a date variable with a value retrieved from a SharePoint list.

Related Power Automate tutorials:

>

Build a High-Performance Project Management Site in SharePoint Online

User registration Power Apps canvas app

DOWNLOAD USER REGISTRATION POWER APPS CANVAS APP

Download a fully functional Power Apps Canvas App (with Power Automate): User Registration App

Power Platform Tutorial FREE PDF Download

FREE Power Platform Tutorial PDF

Download 135 Pages FREE PDF on Microsoft Power Platform Tutorial. Learn Now…