How to get Year, Month and day in various formats from a date in Power Automate

Lately I have been working a lot with Power Automate. If you are Power platform consultant who work a lot on Dynamics 365 products and CDS, chances are you are spending an ample amount of time in automating your business solutions using Power Automate.

And while PowerAutomate is going stronger by the day, there are still some basic areas where are not covered yet. And one of these areas is the ability to get the date components. For a real time project, working with date values are chores. And more often than not, we need to play with individual components of a date like year/ month/ day/ hours/ minutes/ seconds etc. rather than the whole date value.

In this blog I am going to cover the following topics.

  • Get Year/ month/ date from a date value in Power Automate
  • Get Year/ Month/ day of week in string format from a date value in Power Automate

For the demo I take the current date as the test date. Below are the expressions to get each of the date components.

Year

int(formatDateTime(utcNow(), 'yyyy'))

Month (Number)

int(formatDateTime(utcNow(), 'MM'))

Month (Abbreviation like Jan/ Feb/ Mar)

formatDateTime(utcNow(), 'MMM')

Full Month Name (January/ February/ March)

formatDateTime(utcNow(), 'MMMM')

Day of Week (Number)

dayOfWeek(utcNow())

Day of Week (Monday/ Tuesday/ Wednesday)

formatDateTime(utcNow(), 'dddd')

Date

formatDateTime(utcNow(), 'dd')

Hope this helps!

You will also like the below posts

Debajit Dutta
Business Solutions MVP


Discover more from Debajit's Power Apps & Dynamics 365 Blog

Subscribe to get the latest posts sent to your email.

Discover more from Debajit's Power Apps & Dynamics 365 Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading