2
Answers

Order data in descending order using AM/PM format in c sharp

outputData = output.OrderByDescending(x => DateTime.ParseExact(x.modifiedDateTime, "MM/dd/yyyy hh:mm:ss", CultureInfo.InvariantCulture)).ToList();

in the above code x.modifiedDateTime stores date in MM/dd/yyyy hh:mm:ss format and we are ordering using MM/dd/yyyy hh:mm:ss format. But now i want to order using MM/dd/yyyy hh:mm:ss tt(AM/PM) format, how could this be done. also modifiedDateTime should be displayed  MM/dd/yyyy hh:mm:ss format

How could this be done. please help on this.

Answers (2)