Get current month index

Hi,

I would like to get the current month index, for example if we’re in January, get 0. February get 1…

Thanks

index = (Date.Today.Month - 1)

Hi jadbenn,
Now.Month will return the 1-based index (January = 1, February = 2 …). Simply subtract 1 to it to find what you need

DateTime.Now.ToString(“MM”)

Try with below. And it worked for me.

DateTime.Now.ToString(“MM”)

If you need the index simply -1 from the current value. Then Jan 1 becomes 0 and Feb 2 comes 1 March 3 comes 2 and so on,