How to convert m/d/yyyy hh:mm:ss am/pm into mm/dd/yyyy format

Hi All, i have an issue to change Date format ,

I will extract the date format in Desktop application like “1/6/2015 5:38:34 AM” , I need to convert the date format into mm/dd/yyyy format,

So my output shoutd be mm/dd/yyyy “01/06/2015”, Kindly please advise to change the date format

@sivaramakrishna_raja If you date is in string format, assign it with variable input_date. then use below expression.

DateTime.ParseExact(“input_date”,“MM/dd/yyyy”, System.Globalization.CultureInfo.InvariantCulture).

1 Like

Simple workaround
if you have date as string you can follow the below to get it converted
convert.ToDatetime(StrDate).ToShortDateString will give date as mm/dd/yyyy

1 Like

Hey, @sivaramakrishna_raja
Hope you having a good day!

you can try this.

1 Like