How to convert Month(Text) into number?

Hello,

I am getting the name of the month in text :i.e. August or March and I would need to convert it to number i.e: 08 or 03. How could I do it?

Thank you

2 Likes

Hi @crowdo

Use sample like Now.ToString(“MM”). ToString

Thanks
Ashwin.S

@crowdo Follow this

Assign input_month = “August”

Assign input_month = Datetime.ParseExact(input_month ,“MMMM”,System.Globalization.CultureInfo.InvariantCulture).ToString(“MM”)

8 Likes

@AshwinS2 Now.ToString(“MM”). ToString Will give only current month in number

1 Like

It is working, thank you very much for your fast reply

1 Like

S tried to gave a sample one

1 Like

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