JS to determine the size of two times
function Checkdate ()
{
To get the date value and convert it to date format, replace (//-/g, "//") converts the date into the date format based on the validation expression, so
It's a good judgment to judge.
var sdate = new Date (document.getElementById ("Txtstart"). Value.replace (//-/g, "//"));
var eDate = new Date (document.getElementById ("Txtend"). Value.replace (//-/g, "//"));
if (Sdate > EDate)
{
Alert ("End date cannot be less than start date");
return false;
}
return true;
}
take 2 of the time apart size
TimeSpan ts1 = new TimeSpan (time1. Ticks);
TimeSpan ts2 = new TimeSpan (ftime2. Ticks);
TimeSpan ts = ts1. Subtract (TS2). Duration ();
if (int. Parse (TS. Days.tostring ()) > 0)
// {
DateDiff + + TS. Days.tostring () + "days";
// }
if (int. Parse (TS. Hours.tostring ()) > 0)
// {
DateDiff + + TS. Hours.tostring () + "hour";
// }
if (int. Parse (TS. Minutes.tostring ()) > 0)
// {
DateDiff + + TS. Minutes.tostring () + "minutes";
// }