I have following strings:
string s1 = "dd/mm/yyyy hh:mm"; // 24H format
string s2 = "mm/dd/yyyy hh:mm:ss AM/PM" //12H format
I need to compare them in my test (it means that i need to convert s1 to s2 or viceversa). Please help!
I have following strings:
string s1 = "dd/mm/yyyy hh:mm"; // 24H format
string s2 = "mm/dd/yyyy hh:mm:ss AM/PM" //12H format
I need to compare them in my test (it means that i need to convert s1 to s2 or viceversa). Please help!
Convert both to DateTime and then compare them:
var result = DateTime.ParseExact(dt1, "dd/MM/yyyy HH:mm", null) > DateTime.ParseExact(dt2, "MM/dd/yyyy hh:mm:ss tt", null);