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 –
- Let’s use a String variable to store all this content in an on-demand Flow.
- And in the Expressions section, look for the day functions.
All three functions take a DateTime timestamp
- 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
- And this gives me the day # of the Month which is equal to the Date itself.
- 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.
- 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.
- And the result is as below –
- 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 –
- So, in other context, I simply used FormatDateTime() function.
- 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 –
- Enable SharePoint Online integration Dynamics 365 | Power Platform Admin Center
- Dynamics 365 Storage Utilization | Dataverse Storage | Power Platform Admin Center
- Use Hierarchy in Roll Up Fields in Dynamics 365 CRM
- Filter records in a View owned by a Team you are a member of | Dynamics 365 CRM
- Get GUID of the current View in Dynamics 365 CRM JS from ribbon button | Ribbon Workbench
- Dynamics 365 App For Outlook missing on SiteMap in CRM? Use shortcut link [Quick Tip]
- Import lookup referencing records together in Dynamics 365 CRM | [Linking related entity data during Excel Import]
- Excel Importing Notes (Annotation) entity in Dynamics 365 CRM
- Enable/Disable the need to Approve Email for Mailboxes in Dynamics 365 CRM CE
- Call Azure Function from Dynamics 365 CRM using Webhooks
- Show Ribbon button only on record selection in Dynamics CRM
- Accessing multiple occurrences of a field in Business Process Flow using JS in D365 CRM