Power Automate dayOfMonth() Function

Are you looking out how to work with the Power Automate dayOfMonth() function? No problem!

In this Power Automate tutorial, I have explained how to use the Power Automate dayOfMonth() function and its syntax. Also, I will show you a few examples of the Power Automate dayOfMonth() function.

The dayOfMonth() function in Power Automate enables the extraction of the day of a month from a provided timestamp in a flow.

Power Automate dayOfMonth() Function

Power Automate dayOfMonth() function returns the day of a month from a given timestamp. This function is simple and easy, resembling the Power Automate dayOfWeek() function.

The dayOfMonth() function extracts the day of a month from a timestamp. This can be utilized with various timestamp inputs like date with time and utcNow().

Power Automate's dayOfMonth() function

This is a brief introduction to the Power Automate dayOfMonth() function.

Power Automate dayOfMonth() Syntax

The Power Automate dayOfMonth() function syntax will look like as shown below:

Syntax: dayOfMonth('timestamp')

The ‘dayOfMonth()’ expects a single parameter that is a timestamp in the expression; if not, it will generate an error in the flow.

Parameters:

Timestamp: It works with only the parameter required to be a ‘String’ and mandatory to provide.

The return value is an integer that gives the output as the day of the month from the specified timestamp.

Example:

 dayOfMonth('2023-12-11T13:27:36Z')

Where,

  • 2023-12-11T13:27:36Z will be a timestamp that needs to be specified.

The dayOfMonth() function will return the output as 11, which is the day of the month.

This is the Power Automate dayOfMonth() function syntax format in a flow.

Power Automate dayOfMonth() of utcNow

Let’s begin with examples of the dayOfMonth() function by creating an ‘Instant cloud flow’ that will trigger manually.

Example

Within this example, we wanted to extract the day of the current date within the month. So Today’s date “11/12/2023 “. Then, my result will be 11, representing the 11th day of the month, as shown below.

For that, you can follow the steps that are mentioned below.

1. Log in to Power Automate with your Microsoft credentials -> In the Power Automate Home page, tap +Create -> Select Instant cloud flow -> In the next window, Provide a flow name & select trigger Manullay trigger a flow -> Tap Create button.

2. Following that, include an ‘Initialize variable‘ flow action to retain the text values throughout the flow. Be sure to specify the details of the variable.

  • Name = Provide the variable name as Date.
  • Type = Select variable type as String.
  • Value = Select the field -> Click Expression and write the code below:
dayOfMonth(utcNow())

After giving the expression, Select OK.

Power Automate dayOfMonth() Function

3. Add the Compose flow action to verify the output generated by the dayOfMonth() expression.

Inputs: Select the field -> Take the Date variable from dynamic content.

Power Automate get current day of month

4. By completing the flow, Save the flow. After that, Test it Manually. When the flow runs successfully, it displays the notification as ‘Your flow ran successfully.’

5. The compose flow action shows that dayOfMonth() will extract the day of the month, as shown below.

  • The result of a dayOfMonth() expression will be the 11th day of a month.
Power Automate dayOfMonth() Expression

This is how to get the day of a month from utcNow using the Power Automate dayOfMonth() function.

Power Automate dayOfMonth() from SharePoint Date

In this example, I will show you the Power Automate dayOfMonth()function, taking the SharePoint list as a reference in an Automated cloud flow.

Example:

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

dayOfMonth() Function in Power Automate

We wanted to extract the day of the month from the SharePoint date column using Power Automate. Let’s imagine a date “25/12/2023“, which will provide the result as 25, the 25th day of a month.

How to use dayOfMonth() function Power Automate

Follow the same steps that are mentioned in the above example.

1. Navigate to make.powerautomate.com in the browser to open the Power Automate Home page. On the Home page, click +Create -> Select Automated cloud flow -> Give flow name and choose the trigger -> Click Create button.

Inside the trigger, provide the below details, as shown in the screenshot.

  • 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 get day of month from date

2. After that, initialize the Course Enrolling Date column. For that, take an Initialize variable flow action. Then, set the details of the variable.

  • Name: Enter the name manually.
  • Type: Select datatype as String from the drop-down.
  • Value: Select the value as Course Enrolling Date from dynamic content.
How to use Power Automate dayOfMonth() function

3. Under the trigger, include the dayOfMonth() expression with the variable in the Compose flow action.

Inputs: Select a field -> Click Expression -> Take the below expression.

Click on OK.

dayOfMonth(variables('Course Enrolling Date'))
Power Automate flow dayOfMonth() function

4. Save the flow and run the flow manually once the flow is created. Following that, add an item to the associated SharePoint list.

dayOfMonth() expression in a Power Automate flow

5.  When the flow runs successfully, it will display the output in the compose flow action. If the dayOfMonth() function satisfies, then it will extract the day of the month from the date as below.

  • The return value from the dayOfMonth() expression will be 13.
Use Power Automate dayOfMonth() function

This is how to use the Power Automate dayOfMonth() expression to return the day of the month from a timestamp.

Conclusion

In this Power Automate tutorial, I have explained how to use the dayOfMonth() function in Power Automate. I have described the syntax of the Power Automate dayOfMonth() function and covered a few examples of the dayOfMonth() function in Power Automate as mentioned below:

  • Power Automate dayOfMonth() from SharePoint Date
  • Power Automate dayOfMonth() from utcNow

Also, you may like some more Power Automate tutorials: