How to Get Last Day of Current Month in Power Automate

```html id="lastdaycurrentmonth"

How to Get Last Day of Current Month in Power Automate

Working with dates is one of the most common requirements in Power Automate. Organizations frequently need to determine the last day of the current month for reporting, payroll processing, invoice generation, subscription renewals, and other month-end activities.

Instead of manually updating dates every month, Power Automate allows you to calculate the last day of the month dynamically using built-in date and time functions.

This approach ensures accuracy, reduces manual effort, and supports automation across business processes.


Why Get the Last Day of the Current Month?

Many business processes depend on month-end calculations.

Common examples include:

Example:

Current Date:

15-Jul-2025

Required Result:

31-Jul-2025

Power Automate can calculate this automatically regardless of the month.


How the Logic Works

The simplest approach is:

Current Date
↓
Move to Next Month
↓
Get First Day of Next Month
↓
Subtract One Day
↓
Last Day of Current Month

This works for:

without any additional logic.


Power Automate Expression

Use the following expression:


subtractFromTime(
    startOfMonth(
        addToTime(
            utcNow(),
            1,
            'Month'
        )
    ),
    1,
    'Day'
)

Output:

2025-07-31T00:00:00Z

Format the Date

To display the date in a user-friendly format:


formatDateTime(
subtractFromTime(
startOfMonth(
addToTime(
utcNow(),
1,
'Month'
)
),
1,
'Day'
),
'dd/MM/yyyy'
)

Output:

31/07/2025

Using Compose Action

Add a Compose action in your flow.

Expression:


formatDateTime(
subtractFromTime(
startOfMonth(
addToTime(
utcNow(),
1,
'Month'
)
),
1,
'Day'
),
'yyyy-MM-dd'
)

Result:

2025-07-31

This value can be reused throughout the flow.


Example Flow

Recurrence Trigger
↓
Compose Action
↓
Calculate Last Day
↓
Generate Report
↓
Send Email

This is a common implementation for monthly automation.


Send Month-End Notification

Suppose you want to send a reminder email on the last day of the month.

Email Body:

The current month ends on:

31-Jul-2025

Expression:


formatDateTime(
subtractFromTime(
startOfMonth(
addToTime(
utcNow(),
1,
'Month'
)
),
1,
'Day'
),
'dd-MMM-yyyy'
)

Output:

31-Jul-2025

Update SharePoint Date Column

SharePoint Date columns require a valid date format.

Expression:


formatDateTime(
subtractFromTime(
startOfMonth(
addToTime(
utcNow(),
1,
'Month'
)
),
1,
'Day'
),
'yyyy-MM-dd'
)

Example Output:

2025-07-31

This value can be stored directly in SharePoint.


Update Dataverse Date Field

Dataverse Date Only columns also require valid date values.

Expression:


formatDateTime(
subtractFromTime(
startOfMonth(
addToTime(
utcNow(),
1,
'Month'
)
),
1,
'Day'
),
'yyyy-MM-dd'
)

Output:

2025-07-31

Perfect for Dynamics 365 and Dataverse integrations.


Check Whether Today is Month-End

Sometimes you only want a flow to run on the last day of the month.

Use:


equals(
formatDateTime(
utcNow(),
'yyyy-MM-dd'
),
formatDateTime(
subtractFromTime(
startOfMonth(
addToTime(
utcNow(),
1,
'Month'
)
),
1,
'Day'
),
'yyyy-MM-dd'
)
)

Output:

True

or

False

Real-World Example

Payroll Automation

Business Requirement:

Process employee salaries on the final day of every month.

Workflow:

Scheduled Flow
↓
Calculate Month-End Date
↓
Generate Payroll
↓
Create Salary Records
↓
Send Payslips

The flow automatically identifies the correct month-end date every month.


Another Example – Monthly Report Generation

Requirement:

Generate monthly reports automatically.

Flow:

Scheduled Trigger
↓
Check Last Day
↓
Generate Report
↓
Export PDF
↓
Email Management Team

No manual intervention required.


Common Date Formats

DD/MM/YYYY


formatDateTime(DateValue,'dd/MM/yyyy')

Output:

31/07/2025

MM/DD/YYYY


formatDateTime(DateValue,'MM/dd/yyyy')

Output:

07/31/2025

DD-MMM-YYYY


formatDateTime(DateValue,'dd-MMM-yyyy')

Output:

31-Jul-2025

Full Date


formatDateTime(DateValue,'dddd, dd MMMM yyyy')

Output:

Thursday, 31 July 2025

Best Practices


Benefits


Common Use Cases


Conclusion

Calculating the last day of the current month in Power Automate is a common requirement for many business processes.

By combining startOfMonth(), addToTime(), subtractFromTime(), and formatDateTime(), you can dynamically determine month-end dates with complete accuracy.

Whether you're working with SharePoint, Dataverse, Dynamics 365, reporting systems, payroll processes, or subscription management, this technique helps build smarter and more reliable automation solutions.

```