How to compare two dates in servoy that is I would like check whether date stored in database is current date(not time).
Do I need to add a new routine to compare date, month and year seperately with current date.
function DAYSBETWEEN(dDate1, dDate2, lIncludeTime){
var nDays=0;
if(!lIncludeTime){
dDate1=new Date(dDate1.getFullYear(),dDate1.getMonth(),dDate1.getDate());
dDate2=new Date(dDate2.getFullYear(),dDate2.getMonth(),dDate2.getDate());
nDays=Math.round((dDate1.valueOf()-dDate2.valueOf())/(60*60*24*1000));
}else{
nDays=(dDate1.valueOf()-dDate2.valueOf())/(60*60*24*1000);
}
return nDays;
}
Users browsing this forum: No registered users and 27 guests