Get start date of month and last date of month dynamically from Power Automate

There can be multiple business use cases where you want to know start date and end date of the month in a dynamic manner, either where a date is provided to you, or you are using current date. For example, if you want to filter your data-source to show records for an entire month.

This can be achieved using expressions within Power Automate. In this post, we are using current date/time to obtain first and last date of the month.

Start date of the month

startOfMonth(utcNow(),'yyyy-MM-dd')


Last date of the month

There is no in-built function to calculate last day of month, so we will first calculate first day of the next month and then subtract 1 day from it.

First date of next month: startOfMonth(addToTime(utcNow(),1,'month'),'yyyy-MM-dd')

Last date of current month:
addDays(startOfMonth(addToTime(utcNow(),1,'month')),-1,'yyyy-MM-dd')




Comments

Popular posts from this blog

Generate QR code within Power Automate

Restrict Attachment control in PowerApps to accept Excel files only

Get start and last date of month using Power Apps