//Script
var d1 = "18-10-2014";
var d2 = "18-9-2014";
var split = d1.split('-');
var s2= d2.split('-');
var initial=[split[1], split[0], split[2]].join('/');
var i2=[s2[1], s2[0], s2[2]].join('/');
var da =new Date(initial);
var daq =new Date(i2);
var da1=new Date(da.getFullYear(),da.getMonth(),da.getDate());
var da2=new Date(daq.getFullYear(),daq.getMonth(),daq.getDate());
if(da1>da2)
{
alert(1);
}
if(da1<da2)
{
alert(2);
}
//Result
var d1 = "18-10-2014";
var d2 = "18-9-2014";
var split = d1.split('-');
var s2= d2.split('-');
var initial=[split[1], split[0], split[2]].join('/');
var i2=[s2[1], s2[0], s2[2]].join('/');
var da =new Date(initial);
var daq =new Date(i2);
var da1=new Date(da.getFullYear(),da.getMonth(),da.getDate());
var da2=new Date(daq.getFullYear(),daq.getMonth(),daq.getDate());
if(da1>da2)
{
alert(1);
}
if(da1<da2)
{
alert(2);
}
//Result
No comments:
Post a Comment