bujjibabu bujjibabu - 5 months ago 11
SQL Question

convert date from 22/06/2016 1:54 pm to 2016-06-22 1:54 pm format

convert 22/06/2016 1:54 pm to 2016-06-22 1:54 pm format

Eli Eli
Answer

You can also use ParseExact:

var result =
    DateTime.ParseExact("22/06/2016 1:54 pm", "dd/MM/yyyy h:mm tt", CultureInfo.InvariantCulture)
        .ToString("yyyy-MM-dd h:mm tt");