Power Automate startOfDay() Function

Have you ever used the Power Automate startOfDay() function in a flow? No problem! Check out this complete tutorial to learn everything about it.

In this Power Automate tutorial, I will introduce the startOfDay() function, the startOfDay() function syntax, and some examples based on this function.

The startOfDay() function in Power Automate retrieves the exact start time of a day, with all hours, minutes, and seconds beginning with zero as time units.

Power Automate startOfDay() Function

Microsoft Power Automate startOfDay() function will be useful to get the beginning of a day or a timestamp.

The return output from the startOfDay() function will be timestamp specified, which is a string type, but starting at midnight that day.

Let’s say the timestamp is “19-12-2023“. I wanted to get the start of the day of this particular date. Then, my result will be 2023-12-19T00:00:00.0000000Z.

Format of startOfDay() expression in Power Automate

This is the overview of the Power Automate startOfDay() function.

Power Automate startOfDay() Syntax

Here is the syntax for the Power Automate startOfDay() function looks:

startOfDay('timestamp', 'format')

Parameters:

  1. Timestamp: It works with only one parameter required to be a String and mandatory to provide.
  2. Format: It is an optional field where a user can give a specified format for date and time. If the format is not given, it will take the default format. The default format for the timestamp is (yyyy-MM-ddTHH:mm: ss.fffffffK).

Example:

startOfDay('2023-12-18')
  • 2018-12-18 = Provide a specific date.

It gives the output as 2023-12-18T00:00:00.0000000Z.

This is the format of syntax for the Power Automate startOfDay() function inside a flow.

Power Automate startOfDay() of utcNow

Let’s see how to start the day for utcNow() using a Power Automate flow.

Example:

Let’s assume Today’s date is “19-12-2023“, and I need to get the current day’s start day. Then, the result will be 2023-12-19T00:00:00.0000000Z.

startOfDay() expression in Power Automate

Delve into the below-given steps!

1. Browse https://make.powerautomate.com to open the Power Automate Home page with your Microsoft credentials. Then click +Create -> Select Instant cloud flow -> Provide a flow name & select trigger Manullay trigger a flow -> Tap Create button.

  • Inside the trigger -> Select the input to Trigger Date.
Power Automate startOfDay() of utcNow

2. To initiate the string variable and assign the utcNow() value, add an Initialize variable flow action. Set the properties of the variable like below:

  • Name: Provide the name manually as the utcNow.
  • Type: Select the variable type as a String from the drop-down menu.
  • Value: Select a field -> Click Expression -> Insert below expression.
startOfDay(utcNow())

After giving the expression, Click on OK.

Power Automate startOfDay of utcNow()

3. To integrate outputs from the initialized variable into the workflow, add the Compose flow action.

  • Inputs: Select the field -> Choose a utcNow variable from the dynamic content.
Use startOfDay() function in Power Automate

4. Now it’s time to Save and Test the flow. Run the flow manually.

5. After running the flow successfully, the composed output will get a start day of the current date, as displayed in the screenshot below.

  • The result from the Power Automate startOfDay() expression will be 2023-12-19T00:00:00.0000000Z.
Note: It is important to note that while utcNow() returns the current date and time, invoking the startOfDay function will only return the date at midnight, without the time component that begins with zero as a timeunit.
How to use startOfDay() expression in Power Automate

This is how to get the start day of the current date using the Power Automate startOfDay() function.

Power Automate startOfDay() of Date Variable

In this section, we will look at how to get the start of a day from the date variable.

Example:

Let’s consider a time stamp “25-12-2023“. Now, I wanted to get the start day of this particular time stamp. Then my result will be like 2023-12-25T00:00:00.

Microsoft Power Automate startOfDay() expression

To work with this, follow the below-given steps:

1. Take an Initialize variable flow action to initialize the trigger date, which will be useful to store the triggered date values in it and can be used during the flow.

Set the parameters of an initialize variable:

  • Name: Provide the name manually as the Date.
  • Type: Select the variable type as a String from the drop-down menu.
  • Value: Select a field -> Take Trigger Date from the dynamic content.
Power Automate startOfDay() of Date Variable

2. To give the expression to startOfDay(), choose and add a Compose flow action.

Inputs: Select the field -> Select Expression -> Give the code below.

startOfDay(variables('Date'),'dd/MM/yyyyTHH:mm:ss')
Power Automate startOfDay() function

3. After saving the flow, pick a specific date in the run flow window that needs to be triggered. After that, select Run flow.

Microsoft Power Automate startOfDay() of Date Variable

4. When the flow runs successfully, the compose outputs will display the triggered date with the start of the day, as shown below.

Microsoft Power Automate startOfDay() format

This is how to get the start day of a date variable using the Power Automate startOfDay() function.

Power Automate startOfDay() of SharePoint Date

Upon implementing the previous example, we will now see how to retrieve the start day from a SharePoint date column using Power Automate.

Example:

I have taken a SharePoint list named [Course Enrollment] with a date column as Course Enrolling Date. This list has various items along with dates, as shown below:

startOfDay() function in Power Automate

My objective is to extract the day’s start time from the SharePoint date column named “Course Enrolling Date” using Power Automate. For instance, if we take the date “30/12/2023,” the result will be 2023-12-30T00:00:00.

Power Automate startOfDay() function expression

Do follow the below-mentioned steps:

1. Log into Power Automate with your Microsoft credentials -> In the Power Automate Home page, tap +Create -> Select Automated cloud flow -> Provide a flow name & select trigger When an item is created or modified -> Tap the Create button.

  • Site Address: Select a SharePoint site address from the drop-down.
  • List Name: Choose a specific SharePoint list name from the drop-down.
Power Automate startOfDay() of SharePoint Date

2. Initialize the Course Enrolling Date column with the Initialize variable flow action. Set the parameters of the variable.

  • Name: Provide the name manually as the Course Enrolling Date.
  • Type: Select the variable type as String.
  • Value: Select the field -> Take Course Enrolling Date from the dynamic content of the SharePoint list.
Power Automate  get startOfDay() of SharePoint Date

3. Place the startOfDay() expression and the value from the initialized variable into the Compose flow action. Set the below details.

  • Select a field -> Click Expression -> Insert below expression.
startOfDay(variables('Course Enrolling Date'),'yyyy-MM-ddTHH:mm:ss')

After taking the expression, Click OK.

How to use startOfDay() function to get SharePoint date

4. Once the flow is created, Save and test the flow manually. After that, modify or add an item to the corresponding SharePoint list. Now, I will modify an existing SharePoint list item as shown below.

startOf Day() expression in Power Automate to get SharePoint date

5. When the flow runs successfully, it will display the output in the compose flow action. The return value from the startOfDay() expression will be like 2023-12-30T00:00:00.

Power Automate startOfDay() expression

This is how to get the start of the day for a SharePoint list date column using the Power Automate startOfDay() function inside a flow.

Conclusion

I trust this tutorial helped you comprehensive understanding of how to utilize the startOfDay() function optimally in Power Automate. Moving forward, I have covered the function’s syntax and given various examples of its implementation in Power Automate.

  • Power Automate startOfDay() of utcNow
  • Power Automate startOfDay() of date variable
  • Power Automate startOfDay() of SharePoint date

Also, you may like some more Power Automate tutorials: