Transform the name of the month into its equivalent in number

I have a process that as input takes the dates like “26 / mar / 21” in Spanish and I need to convert the month by the corresponding number “03/26/21”

Using follow code will give you the result what you want.
(you have to change “en-US” with your country code)
try it!

[Code]
DateTime.Parse(“26 / mar / 21”, CultureInfo.CreateSpecificCulture(“en-US”)).ToString(“MM/dd/yy”)

@Marisa_Ontiveros1

Check below post for your reference

Hope this may help you

Thanks

It does not work for me, it gives me an error.

@Marisa_Ontiveros1
grafik
Line1 - shows the expected abbreviated month names (kindly note the dot on end)
Line2 - fails due missing dot
Line3 - works as it has dot on end

So try following (with a strategy of checking and correcting the missing dot)
grafik

Another option instead of adding the dot to the data is to parse the date with a customized CultureInfo:

grafik

CICustomized = CultureInfo.CreateSpecificCulture("es-ES")

CICustomized.DateTimeFormat.AbbreviatedMonthNames = CICustomized.DateTimeFormat.AbbreviatedMonthNames.Select(Function (x) x.Replace(".","")).ToArray

Log: DateTime.ParseExact("26 / mar / 21", "dd / MMM / yy",CICustomized).toString("MM/dd/yy")
grafik

Find starter help here:
Parsing_WithCustomizedShortMonthNames.xaml (5.0 KB)

Ensure:
grafik

Hey can you help me to get the date (MM/DD/YYYY) for this
image