How to get previous month (full name)

Hello,

I have followed a previous post to use “DateTime.Now.AddMonths(-1).ToString(“MMM”)”. While it does work, I prefer to have the full month’s name. Anyway this can be done?

You were almost done
the expression should be like ths
DateTime.Now.AddMonths(-1).ToString(“MMMM”)

Cheers @rojem

2 Likes

Hi @Rojem,

As @Palaniyappan said, you can use “MMMM” to get the full name of the month.
You can check all the formats available here:
https://docs.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings

Thanks and best regards,
Susana

1 Like

Thanks all, @Susana @Palaniyappan

2 Likes

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.