I\'m writing an equipment rental application where clients are charged a fee for renting equipment based on the duration (in days) of the rental. So, basically, (daily fee *
Since the Julian day is effectively the number of days (and in some cases also the fraction of number of days) since a certain date, it is practically the same as a UNIX timestamp, presented differently. You can get the number of whole days since 1970 like so:
Date.prototype.getWholeDays = function () {
return Math.floor(new Date() / 1000*60*60*24);
};
function dateDiff(startDate, endDate) {
return endDate.getWholeDays() - startDate.getWholeDays();
}