web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / formatDateTime return ...
Power Automate
Unanswered

formatDateTime return the wrong date format

(0) ShareShare
ReportReport
Posted on by 4

Hi all, 

I'm lost in a very simple date format issue that I can't understand. Maybe you can help me looking at it from outside

I have a basic expression to return the month number from today's date:

 

formatDateTime(utcNow(),'M')

 

now I expected this to return a number between 1 and 12 (of type string, but still a number), but instead is returning "November 29"

 

what am I doing wrong?

thanks for help

 

Categories:
I have the same question (0)
  • Verified answer
    mahoneypat Profile Picture
    1,720 on at

    You can use this expression instead.  If you want it as just text (01,02, etc.), you can leave off the int( ).

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

    Pat

     

  • lcalamita Profile Picture
    4 on at

    just to outline, for whomever is having the same issue.
    The 'M' notation is reserved for a standard Date Format pre-built by Microsoft, that will return full Month name + Day of month (i.e.: November 29).
    therefore, when using a Custom Date Format (like I was trying to achieve) you're not allowed to return month number with a single digit, but you're obliged to use 'MM' notation.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 538 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard