Working with naming months

Hi everybody.

I am creating a small project solution and I’m a little stuck with solving this situation:
I need to get as a result (to Log message, for example) last month’s name.
Now is February and I want to Log in message “January” (or some kind of format)
Do you know how to do it smartly?
What I did is to
assign to variable Month = now.Month.toString
and then use second assign Month = (CInt(Month)-1).toString
And it works - it gives me number 1, but how to convert it now to display a name of the month?

Thanks a lot for every advice!

Hi Veronika,

You can use this expression: Now.AddMonths(-1).ToString(“MMMM”)



Thank you a lot, Sergej!

1 Like