Get Current Month Name in Power Automate Dynamically
Power Automate provides powerful date and time functions that are essential for automating business processes. Whether it's for scheduling, generating reports, sending notifications, managing approvals, or even naming files, precise date handling is often a requirement. One common need is to dynamically retrieve the current month's name.
Organizations frequently use month names in various contexts such as reports, folder structures, email subjects, invoices, dashboards, and automated workflows. This article will guide you through the process of obtaining the current month's name in Power Automate using its built-in expressions.
Why Get the Current Month Name?
Many automation scenarios benefit from using month names instead of just numeric values. For instance, seeing "January" is often more intuitive than "01" in a report title or file name.
Using month names:
- Improves readability
- Makes reports more user-friendly
Common use cases include:
- Monthly Reports
- Email Notifications
- Folder Creation
- Document Naming
- Invoice Generation
- Dashboard Reporting
Solution Overview
The workflow to get the current month name is straightforward:
- Capture the Current Date (using
utcNow()) - Format the Date to Extract the Month Name (using
formatDateTime()) - Store the Month Name (using a Compose action)
- Use the Month Name in your Workflow
This process ensures that the current month's name is automatically retrieved every time the flow runs, keeping your automations up-to-date.
Understanding the formatDateTime() Function
Power Automate offers the formatDateTime() function, which is instrumental in formatting dates and times into various string representations. To get the full month name, you can use the following syntax:
Expression: formatDateTime(utcNow(), 'MMMM')
This expression takes the current UTC date and time (utcNow()) and formats it to display the full month name ('MMMM'). For example, if the current month is July, the output will be "July".
Step-by-Step Implementation
Step 1: Create a Flow
Begin by creating a new flow. You can choose the trigger type based on your specific business requirement:
- Instant Flow (Manually triggered)
- Automated Flow (Triggered by an event)
- Scheduled Flow (Runs at a specific time)
Step 2: Add a Compose Action
Search for and add the "Compose" action to your flow. This action is ideal for storing the generated month name temporarily or making it readily available for use in subsequent steps.
Step 3: Enter the Expression
In the "Inputs" field of the Compose action, enter the following expression:
Expression: formatDateTime(utcNow(), 'MMMM')
If the current month is July when the flow runs, the "Outputs" of this Compose action will be "July".
Full Month Name vs. Short Month Name
The formatDateTime() function allows you to choose between the full month name and a shortened version. This flexibility is crucial for adapting to different requirements.
- Full Month Name:
- Expression:
formatDateTime(utcNow(), 'MMMM') - Output Example:
September
- Expression:
- Short Month Name:
- Expression:
formatDateTime(utcNow(), 'MMM') - Output Example:
Sep
- Expression:
Choose the format that best suits your business needs.
Practical Applications
Using Current Month in Email Subjects
Dynamically including the current month in email subjects enhances clarity and organization for automated communications.
Example Expression:
concat('MonthlyReport-', formatDateTime(utcNow(), 'MMMM'))
Output Example: MonthlyReport-July
This is particularly useful for automated reporting emails.
Using Current Month in File Names
Automating file naming conventions with the current month ensures that reports and documents are easily identifiable and sortable.
Example Expression:
concat('SalesReport_', formatDateTime(utcNow(), 'MMMM'), '.xlsx')
Output Example: SalesReport_July.xlsx
This helps in automatically organizing monthly reports.
Using Current Month in SharePoint Folders
For document management systems, creating month-based folders automatically keeps your files organized.
Example Folder Name: July2025
Expression:
concat(formatDateTime(utcNow(), 'MMMM'), formatDateTime(utcNow(), 'yyyy'))
Output Example: July2025
This is very useful for document management systems.
Real-World Example: Monthly Sales Report
Consider a requirement to generate a monthly sales report automatically.
Workflow:
- Scheduled Flow: Trigger the flow at the end of each month or beginning of the next.
- Get Current Month Name: Use
formatDateTime(utcNow(), 'MMMM')to capture the current month. - Create Report: Generate the sales report, potentially incorporating the month name into the report title or file name.
- Send Email: Send the report via email, with the subject line including the month name.
- Archive File: Save the generated report to a location like SharePoint, organized by month.
Result: Users receive a report with the correct month name every month, ensuring timely and accurate information delivery.
Common Use Cases Recap
- Email Notifications: Include the current month in subject lines for better context.
- Monthly Reports: Generate dynamic report names that clearly indicate the period covered.
- SharePoint Folders: Create month-based folders automatically to organize documents.
- Invoice Processing: Add month names to invoice references for easier tracking.
- Dashboard Reporting: Display readable date information that users can easily understand.
Best Practices
- Use Full Month Names for Reports: For enhanced readability in reports, use the full month name (e.g.,
January,February,March). - Use Short Names for File Names: For file names where space might be a concern, use short month names (e.g.,
Jan,Feb,Mar). - Use
utcNow()Consistently: Rely onutcNow()for standardized date and time handling across your flows to avoid time zone issues. - Test Different Regions: If your users are in various regions, validate date formatting in different locales to ensure consistency.
- Use Dynamic Naming Standards: Implement clear and dynamic naming conventions for reports and files to improve organization and retrieval.
Benefits of Dynamic Month Naming
- Improved Readability: Month names are inherently easier to understand than numeric date representations.
- Automated File Naming: Create meaningful and automatically generated report and document names.
- Better Reporting: Generate user-friendly and contextually relevant reports.
- Consistent Automation: Ensure standardized date formatting across all your automated workflows.
- Reduced Manual Effort: Eliminate the need for manual entry of month names, saving time and reducing errors.
Conclusion
Retrieving the current month's name in Power Automate is a simple yet powerful capability, easily achieved using the formatDateTime() function. Whether you are generating reports, creating folders, sending emails, or building dashboards, dynamic month names significantly improve readability and the efficiency of your automations.
By implementing these date formatting best practices, organizations can build scalable workflows that automatically adapt to changing dates and reporting periods, streamlining operations and enhancing data management.