Convert date italian

Hello friends,
@Rammohan91, @balupad14, @Gouda_6, @Florent_Salendres, @ClaytonM, @vvaidya, @Palaniyappan
I need to convert the string “03-mag-19” from the format “dd-MMM-yy” to “dd/MM/yyyy”.
How to do that in Italian?
Thank you,
CAmi

Did you tried these link.

Might be useful

1 Like

Hi Buddy @CamiCat

Welcome back again
so to convert this use like in assign activity
mydate = DateTime.Now.ToString(“dd/MM/yyyy”,new CultureInfo(“it”))

EDIT :  
out_date = DateTime.ParseExact(in_date,"dd/MM/yyyy",new CultureInfo("it")).ToString
1 Like

Using @Palaniyappan idea with CultureInfo, you will need to use ParseExact, I think.

To convert that string, it will be like this:
DateTime.ParseExact("03-mag-19","dd-MMM-yy", new CultureInfo("it")).ToString("dd/MM/yyyy")

If the month is the full name, like "03-maggio-19, then change format from dd-MMM-yy to dd-MMMM-yy

I hope that helps.

Regards.

4 Likes

aahah, right…exactly with parseexact…

Thanks buddy @ClaytonM

Cheers…

1 Like

Oh, you can also use Parse. @camicat @Palaniyappan

Like this:
DateTime.Parse("03-mag-19", new CultureInfo("it")).ToString("dd/MM/yyyy")

…since it is in a recognizable date format already.

So use that which is better I think, but both work.

Regards.

3 Likes

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