How to convert a month name to its corresponding month number?Any one help pls?

for example aug-08, june-06

Hi @ASWATHY_K

Try with this expression

DateTime.ParseExact("aug","MMM",System.Globalization.CultureInfo.InvariantCulture).ToString("MM")

Regards
Gokul

HI @ASWATHY_K

How about this expression?

DateTime.ParseExact("june",{"MMMM","MMM"}, System.Globalization.CultureInfo.InvariantCulture,System.Globalization.DateTimeStyles.None).ToString("MM")

image

Regards
Gokul

Hello @ASWATHY_K
Refer to this thread

Thkz @Gokul001
but this showing a error.

Hey @ASWATHY_K

Try with this it will work for both case aug and june

Regards
Gokul

@ASWATHY_K
Try this

Month(DateValue("1 "+Month_Name+" 2022")).ToString

image

Thkz this is working

1 Like

Great @ASWATHY_K

Kindly close this topic by mark as solved.

Regards
Gokul

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