cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
pconnell
Level: Powered On

Date formatting a single digit month 'M' is wrong in Flow

I'm using addDays(utcNow(), -15, 'M') in a flow - expecting '8' for September for instance.  I get 'August 28' returned in the flow!

 

Using 'MM' I get '08' - I can then int() this correctly.

 

I've checked https://docs.microsoft.com/en-gb/dotnet/standard/base-types/custom-date-and-time-format-strings#M_Sp... to confirm that 'M' is a single digit month formatter.  Why am I getting a different format?

3 REPLIES 3
Community Support Team
Community Support Team

Re: Date formatting a single digit month 'M' is wrong in Flow

Hi @pconnell,

 

I have tested on my side, it also returns "August 28" if I use the addDays(utcNow(), -15, 'M').

And if I use the  addDays(utcNow(), -15, 'MM'), it will return '08'.

The Code is used in C#, the return value of M has been converted into the letter.

DateTime date1 = new DateTime(2008, 8, 18);
Console.WriteLine(date1.ToString("(M) MMM, MMMM",
CultureInfo.CreateSpecificCulture("en-US")));
// Displays (8) Aug, August
Console.WriteLine(date1.ToString("(M) MMM, MMMM",
CultureInfo.CreateSpecificCulture("nl-NL")));
// Displays (8) aug, augustus
Console.WriteLine(date1.ToString("(M) MMM, MMMM",
CultureInfo.CreateSpecificCulture("lv-LV")));
// Displays (8) Aug, augusts

 

Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

pconnell
Level: Powered On

Re: Date formatting a single digit month 'M' is wrong in Flow

I'm using flow, how do I achieve this in that?  

Community Support Team
Community Support Team

Re: Date formatting a single digit month 'M' is wrong in Flow

Hi @pconnell,

 

There is no way to use it, the only way you can do it is the method you at the first mentioned that use the expression "addDays(utcNow(), -15, 'MM')" and use the int() function to process it.

Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Users Online
Currently online: 389 members 4,566 guests
Please welcome our newest community members: