Convert 11th of june 2021 to dd/mm/yyyy

Hi,
is it possible to convert
str = “11th june 2021”
to dd/mm/yyyy

Thank you

Hi,

Can you try the following expression?

DateTime.ParseExact(System.Text.RegularExpressions.Regex.Replace(yourString,"(?<=^\d+)[^\d\s]+",""),"dd MMMM yyyy",System.Globalization.CultureInfo.InvariantCulture).ToString("dd/MM/yyyy")

Regards,

1 Like

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