I have a two date like from and to date. date format like 28-Sep-2013 and 01-Sep-2013. I want to compare date and show error message. I have use this code,
var from = $('#<%= txtFDateEdu.ClientID %>').val();
var to = $('#<%= txtTDateEdu.ClientID %>').val();
var dateTypeVar = $('#<%= txtFDateEdu.ClientID %>').datepicker('getDate');
var dateTypeVarto = $('#<%= txtFDateEdu.ClientID %>').datepicker('getDate');
$.datepicker.formatDate('dd-mm-yy', dateTypeVar);
var datefrom = $.datepicker.formatDate('dd/mm/yyyy', dateTypeVar);
var dateto = $.datepicker.formatDate('dd/mm/yyyy', dateTypeVarto);
alert(datefrom);
if (datefrom > dateto) {
alert("Success");
}
else {
}
This code is not working properly. Some issue occur in date format. Please any one help me to solve date format issue and compare date properly. i also use this code.
var from = $('#<%= txtFDateEdu.ClientID %>').val();
var to = $('#<%= txtTDateEdu.ClientID %>').val(;)
alert(from);
alert(to);
var datefrom = new Date(from);
var dateto = new Date(to);
alert(datefrom);
alert(dateto);
if (datefrom > dateto) {
alwer("Success");
}
else {
}
but this also not work properly.