Convert Date Format (08/22/2015) into Standard Format like "Fri Aug 07 2015 17:28:05 GMT+0530"
if (document.getElementById("tillDate").value != "") {
var tillDate = document.getElementById("tillDate").value;// $('#tillDate').datepicker('getDate');
var m = tillDate.split("/")[0];
var dayYear = tillDate.split("/")[1];
var day = dayYear.split("/")[0];
var n = tillDate.lastIndexOf("/");
var n = n + 1;
var year = tillDate.substring(n);
var format = year + "-" + m + "-" + dayYear;
var monthStart = new Date(year + "-" + m + "-" + dayYear);
var Datevalue = monthStart.getFullYear() + "-" + (monthStart.getMonth() + 1) + "-" + monthStart.getDate();
Alert (Datevalue );
}
var tillDate = document.getElementById("tillDate").value;// $('#tillDate').datepicker('getDate');
var m = tillDate.split("/")[0];
var dayYear = tillDate.split("/")[1];
var day = dayYear.split("/")[0];
var n = tillDate.lastIndexOf("/");
var n = n + 1;
var year = tillDate.substring(n);
var format = year + "-" + m + "-" + dayYear;
var monthStart = new Date(year + "-" + m + "-" + dayYear);
var Datevalue = monthStart.getFullYear() + "-" + (monthStart.getMonth() + 1) + "-" + monthStart.getDate();
Alert (Datevalue );
}
Comments