JS judges the size of two times
Function checkdate ()
{
// Get the date value and convert it to the date format. Replace (//-/g, "//") converts the date to the Growth date format based on the validation expression.
// Judge again.
VaR sdate = new date (document. getelementbyid ("txtstart"). value. Replace (//-/g ,"//"));
VaR edate = new date (document. getelementbyid ("txtend"). value. Replace (//-/g ,"//"));
If (sdate> edate)
{
Alert ("the end date cannot be earlier than the start date ");
Return false;
}
Return true;
}
Take the two time intervals
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 () + "day ";
//}
// If (Int. parse (TS. Hours. tostring ()> 0)
//{
// Datediff + = ts. Hours. tostring () + "Hour ";
//}
// If (Int. parse (TS. Minutes. tostring ()> 0)
//{
// Datediff + = ts. Minutes. tostring () + "Minute ";
//}