Conversion of date format "11/27/2019" to "27-Nov-19"

Can anyone help me in below cases

Case1 : How can i convert date format from “11/27/2019” to “27-Nov-19”
Case2: Date format from “27-Nov-19” to “11/27/2019”

1 Like

Hi @saneeth_kandukuri

1.Convert.ToDateTime(“11/27/2019”).ToString(“dd-MMM-yy”)
2.Convert.ToDateTime(“27-Nov-19”).ToString(“MM/dd/yyyy”)

Thanks
Ashwin S

1 Like

Yah this expression would do that
DateTime.ParseExact(“11/27/2019”,”MM/dd/yyyy”,System.Globalization.CultureInfo.InvariantCulture).ToString(“dd-MMM-yyyy”)

And for this

DateTime.ParseExact(“27-Nov-2019”,”dd-MMM-yyyy”,System.Globalization.CultureInfo.InvariantCulture).ToString(“MM/dd/yyyy”)

Cheers @saneeth_kandukuri

1 Like

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