cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
New Member

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
Highlighted
Community Support
Community Support

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.

Highlighted
New Member

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

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

Highlighted
Community Support
Community Support

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
firstImage

Super User Program Update

Three Super User rank tiers have been launched!

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

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

Users online (6,001)