Retrieve day number from a Week, Month and Year & day name in Power Automate

At times, while working in Power Automate, you might only want to retrieve the number of Day / Month / Year / Time etc from the DateTime. Or even just the name of the day, given the date.

Here’s a set of functions in Power Automate you can use already!

Day number functions in a Flow

Let’s look at a few examples on how you can retrieve parts of a DateTime –

  1. Let’s use a String variable to store all this content in an on-demand Flow.

  2. And in the Expressions section, look for the day functions.

    dayOfMonth()
    dayOfWeek()
    dayOfYear()


    All three functions take a DateTime timestamp


  3. Example, for simplicity, I’m only considering utcNow() function to refer to the current DateTime instead of using a DateTime variable.
    So, I’ll first use dayOfMonth() function

  4. And this gives me the day # of the Month which is equal to the Date itself.

  5. dayOfWeek will give me 0 for Sunday, 6 for Saturday.



    Since the day of writing this post is a Sunday, it will give me 0.

  6. And dayOfYear() will give me the day number of the year.


    And today is Day 72 of the year.


    First day of the Year starts with 1. You can use the below function to check the first day of the year in dayOfYear() and it will return 1.

  7. And the result is as below –




  8. I also have a previous version of this post as well which you can refer here – FormatDateTime function in a Flow | Power Automate

Name of the Day

If you want to simply retrieve the Name of the day, you can get it using FormatDateTime function –

  1. So, in other context, I simply used FormatDateTime() function.

  2. And got the below answer –


    You can find complete reference of the DateTime formats used in Power Automate in Microsoft’s official post here – https://docs.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings?WT.mc_id=DX-MVP-5003911

Hope this was useful!
Here are some more Power Automate posts you might want to check –

  1. Enable SharePoint Online integration Dynamics 365 | Power Platform Admin Center
  2. Dynamics 365 Storage Utilization | Dataverse Storage | Power Platform Admin Center
  3. Use Hierarchy in Roll Up Fields in Dynamics 365 CRM
  4. Filter records in a View owned by a Team you are a member of | Dynamics 365 CRM
  5. Get GUID of the current View in Dynamics 365 CRM JS from ribbon button | Ribbon Workbench
  6. Dynamics 365 App For Outlook missing on SiteMap in CRM? Use shortcut link [Quick Tip]
  7. Import lookup referencing records together in Dynamics 365 CRM | [Linking related entity data during Excel Import]
  8. Excel Importing Notes (Annotation) entity in Dynamics 365 CRM
  9. Enable/Disable the need to Approve Email for Mailboxes in Dynamics 365 CRM CE
  10. Call Azure Function from Dynamics 365 CRM using Webhooks
  11. Show Ribbon button only on record selection in Dynamics CRM
  12. Accessing multiple occurrences of a field in Business Process Flow using JS in D365 CRM

Thank you!!

Advertisement

One thought on “Retrieve day number from a Week, Month and Year & day name in Power Automate

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.