I shamelessly copied it from here: http://ejohn.org/blog/javascript-pretty-date/