Sometimes you need to know the differences between two dates in days months years whatever.
SQL SERVER
select datediff(day,date1, date2) as days_diff,
datediff(month,date1, date2) as months_diff...
Can also do year, quarter, week, hour, minute, and second dateparts.
Dates can be hard coded or column names.
Coldfusion Function
#DateDiff("datepart", "date1", "date2")#
datepart (yyyy, q, m, w, h, n, s)
JavaScript
A little tricker so further research may be needed to get the expected results.
var DateDiff = {
inDays: function(d1, d2) {
var t2 = d2.getTime();
var t1 = d1.getTime();
return parseInt((t2-t1)/(24*3600*1000));
},
JQuery
var day_diff = datediff("day", date1, date2);