diff --git a/lib/index.js b/lib/index.js index ff9f255..4662d34 100644 --- a/lib/index.js +++ b/lib/index.js @@ -80,6 +80,9 @@ case 'a': return locale.shortDays[d.getDay()]; case 'B': return locale.months[d.getMonth()]; case 'b': // fall through + case 'C': + var y = String(d.getFullYear()); + return y.slice(0,2); case 'h': return locale.shortMonths[d.getMonth()]; case 'D': return _strftime(locale.formats.D || '%m/%d/%y', d, locale); case 'd': return pad(d.getDate()); @@ -87,6 +90,10 @@ case 'F': return _strftime(locale.formats.F || '%Y-%m-%d', d, locale); case 'H': return pad(d.getHours()); case 'I': return pad(hours12(d)); + case 'j': + var y=new Date(d.getFullYear(), 0, 1); + var day = Math.ceil((d.getTime() - y.getTime()) / (1000*60*60*24)); + return day; case 'k': return pad(d.getHours(), ' '); case 'L': return pad(Math.floor(d.getTime() % 1000), 3); case 'l': return pad(hours12(d), ' '); @@ -156,4 +163,4 @@ return hour; } -}()); \ No newline at end of file +}());