I have two date in which one is dd-mm-yyyy hh:mm
format and another in dd-mm-yyyy (D1)
format
fristly i split the dd-mm-yyyy hh:mm
format date to get dd-mm-yyyy (D2)
format only
then i compare the date D2 and D1 like
var D1 = new Date();
var D2 = new Date();
// D1 = 03-05-2014 this date take as an example
// D2 = 28-04-2014 00:00 this date take as an example
// D1 and D2 are taken by input fields.
split the D2 date
dat = D2.split(' ');
D2 = dat[0];
//finally D2 is 28-04-2014
if(D2<=D1)
{
echo "ok";
}
else{
echo "something is wrong";
}
I am always getting the else part, is this because i split the date from 28-04-2014 00:00
to 28-04-2014
?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…