Power Automate startOfHour() Function

Do you know how to start with Power Automate’s startOfHour() function? If not, then you are at the right place. Check out this tutorial!

In this tutorial on Power Automate, I will introduce the startOfHour() function and its syntax and provide examples based on this function.

The Power Automate function “startOfHour()” retrieves the precise start time of an hour, with all units of time starting at zero, including minutes and seconds.

Power Automate startOfHour() Function

The startOfHour() function in Microsoft Power Automate is a useful feature for retrieving the initial time of an hour, including minute and seconds information.

The output of this function returns a string-type timestamp that signifies the start of an hour, along with zero minutes and seconds for that particular timestamp.

For instance, suppose the provided timestamp is “22-12-2023T04:30:30Z‘”. In that case, the startOfHour() function will return the start of that particular hour, which happens to be “2023-12-22T04:00:00.0000000Z“.

Power Automate startOfHour() Function

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

Power Automate startOfHour() Syntax

This will be the format of syntax for the Power Automate startOfHour() function:

startOfHour('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:

startOfHour('2023-12-22')
  • 2023-12-22 = Provide a specific timestamp.

It gives the output as 2023-12-22T04:00:00.0000000Z.

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

Power Automate startOfHour() of utcNow

Now, let’s see how to get the start of an hour from the current time of a particular timestamp using Power Automate.

Example:

Let’s consider Today’s date is “22-12-2023“, and the time is 04:30:30. I need to get the timestamp with the start of the current hour. Then, the result will be 2023-12-22T04:00:00.0000000Z.

Power Automate startOfHour() of utcNow

To achieve this, let’s look at the below given steps.

1. Navigate to 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.
How to use Power Automate startOfHour() Function

2. Add an Initialize variable flow action to initialize the string variable and assign the value of utcNow(). Configure the properties of the variable as follows:

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

After giving the expression, Click on OK.

Use Power Automate startOfHour() expression on utcNow

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

  • Inputs: Select the field -> Choose a Time variable from the dynamic content.
startOfHour() of utcNow in Power Automate

4. Once the flow has been created. Now it’s time to Save and Test the flow. Run the flow manually.

5. Upon executing the flow, the resulting output will showcase the starting hour of the current date and time, as seen in below screenshot.

  • The result from the startOfHour() expression will be 2023-12-22T04:00:00.0000000Z.
Power Automate startOfHour() expression

This is how to get the start hour of the utcNow() using the Power Automate startOfHour() function.

Power Automate startOfHour() of Date Variable

This section will look at how to get an hour’s start from the date variable triggered in a Power Automate flow.

Example:

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

Power Automate startOfHour() of Date Variable

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 required fields of a 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 get startOfHour() function of date

2. Choose and add a Compose flow action to express startOfHour() for the date variable.

  • Inputs: Select the field -> Select Expression -> Give the code below.
startOfHour(variables('Date'),'dd/MM/yyyyTHH:mm:ss')

Then, Click OK.

Microsoft Power Automate get startOfHour() date

3. Once the flow has been saved, select a specific date in the “Run Flow” window for the trigger and click on “Run Flow.”

Microsoft Power Automate get startOfHour() format

4. Upon successfully executing the flow, the compose outputs will display the triggered date with the start of an Hour, as shown below.

  • The result will be 25/12/2023T00:00:00.
Get Power Automate startOfHour() of Date Variable

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

Power Automate startOfHour() of SharePoint Date

Now, let’s see how to get the startOfHour() of a SharePoint date using the Power Automate startOfHour() function inside a flow.

Example:

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

Get startOfHour() of SharePoint Date by Power Automate functions

I aim to extract the hour’s starting time from the SharePoint date column Registration Date using Power Automate.

For example, if we take “30/12/2023,” the extracted time should be displayed as December 30 2023T00:00:00.

Power Automate startOfHour() function format

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 startOfHour() of SharePoint Date

2. To initialize the “Registration Date” column, utilize the “Initialize Variable” flow action and set the relevant parameters.

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

3. Now include the expression startOfHour() along with the value from the initialized variable into the Compose flow action.

Ensure to give details in the inputs as below.

Select a field -> Click Expression -> Insert below expression.

startOfHour(variables('Registration Date'),'MMMM dd yyyyTHH:mm:ss')

After taking the expression, Click OK.

Get startOfHour() of SharePoint Date in Power Automate

4. After creating the flow, save it and test it manually. Now, I will modify the existing SharePoint list item as below.

Get startOfHour() of SharePoint Date in Microsoft  Power Automate

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

How to use Power Automate startOfHour() function expression

Here’s the process for retrieving the SharePoint list date column’s start of the hour using the startOfHour() function using Power Automate.

Conclusion

I hope this tutorial has given you a comprehensive understanding of effectively utilizing the startOfHour() function in Power Automate. In addition to the function’s syntax, I have provided several examples of how it can be implemented in Power Automate.

Some topics I have covered on the Power Automate startOfHour() function are below.

  • Power Automate startOfHour() of utcNow
  • Power Automate startOfHour() of a date variable
  • Power Automate startOfHour() of SharePoint date

Also, you may like some more Power Automate tutorials: