Convert date with string month to a date with an integer month

Hello everyone
I have a list of dates declared as string variables.
If i have for example : “18 MAY 2021”
how can i convert it to : “18-05-2021”
Thank you in advance

grafik

1 Like

Hi @dhouha.cherif ,

Check the below Expression :

DateTime.ParseExact("18 MAY 2021","dd MMM yyyy",System.Globalization.CultureInfo.InvariantCulture).ToString("dd-MM-yyyy")

HI @dhouha.cherif

CDate(“18 MAY 2021”).ToString(“dd-MM-yyyy”)
image

Regards
Sudharsan

1 Like

Hi @dhouha.cherif
DateTime.ParseExact(yourdatevariable.toString(), “dd Mon yyyy”, Globalization.CultureInfo.InvariantCulture)
.ToString(“dd-MM-yyyy”)

Ah I got it , the first one is more clear

@dhouha.cherif but in every case it is not working.

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