cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
pconnell
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?

4 REPLIES 4
v-litu-msft
Community Support
Community Support

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.

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

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.

jake_harvey
Frequent Visitor

This is 2 years old. And I can still confirm that using 'M' in the date formatting functions returns the month spelled out and the day. I'm currently trying to use addToTime to add months to "today" (utcNow()) and get back a single digit month. 

 

As an example, adding 2 months to today, July 16th. Instead of getting a '9'. I'm getting 'September 16'. 

 

At least there's the int() workaround. But this should really be fixed. Who do we report this to? 

Helpful resources

Announcements
2022 Release Wave 1 760x460.png

2022 Release Wave 1 Plan

Power Platform release plan for the 2022 release wave 1 describes all new features releasing from April 2022 through September 2022.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Users online (2,917)