JS pretty date formatter

Takes a JS Date object and converts it to a relative date string, such as “45 minutes ago” or “1 month ago”.
Download: prettydate.js

API

var prettydate = function(
    d /* The JS Date to convert. */
)

Example

Tells you how long it has been since January 18, 2008.
var mydate = new Date();
mydate.setFullYear(2008, 0, 18);
alert(prettydate(mydate));