If there is a space in the string or other segmentation, you can split the Split method, return an array, and then the array of years as a parameter to new date () to generate date type;
If there is no special separator, you can use the substr (X,y) method to take the substring to generate the date, substr (X,y), X represents the start of the string, y to the length of the substring!
If the string is "/" split, it can be converted using Date.parse (DATESTR).
Look at the example with "-" separate
var checkstartdate = Document.form1.checkstartdate.value;
var checkenddate = Document.form1.checkenddate.value;
var arys= new Array ();
var startdate=new date (Arys[0],parseint (arys[1]-1), arys[2]);
if (checkstartdate!= null && checkenddate!= null) {
Arys=checkstartdate.split ('-');
var startdate=new date (Arys[0],parseint (arys[1]-1), arys[2]);
Arys=checkenddate.split ('-');
var checkenddate=new date (Arys[0],parseint (arys[1]-1), arys[2]);
if (StartDate > Checkenddate) {
Alert ("Your check date begins more than the end Time");
Return;
}
}
Take another look.
var nowdate = getdate ()//Get system time
var shendate = document.getElementById ("Billdate"). Value;
var arr=nowdate.split ("");
var arr1=arr[0]. Split ("-");
var arr2=arr[1].split (":");
var nowdate1 = new Date (arr1[0],arr1[1],arr1[2],arr2[0],arr2[1],arr2[2]);