this is overkill, check out moment.js (http://momentjs.com/docs/)