pad = function (val, len) {
			val = String(val);
			len = len || 2;
			while (val.length < len) val = "0" + val;
			return val;
		}
Formats a date, see http://blog.stevenlevithan.com/archives/date-time-format