Change date format "15-Enero-2020"

I have a string type variable with the following date format “15-Enero-2020” and I want to convert it to this format “yyyy-MM-dd” but when I try it it sends me an error, I hope they can help me


image

Try,

DateTime.Parse(strCompleteDate.Trim(), "dd-MMM-yyyy", CultureInfo.InvariantCulture).ToString("yyyy-MM-dd")

image

i tried but i get this

Can you please open the editor and take a screenshot. Also copy the error message and paste it in the editor window



here you have

Sorry… Use this
DateTime.ParseExact(“15-March-2020”, “dd-MMMM-yyyy”, System.Globalization.CultureInfo.InvariantCulture).ToString(“yyyy-MM-dd”)

change the date to the variable name.

2 Likes

it works thank you

1 Like

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