Added %j and %C

This commit is contained in:
Ryan Stafford 2012-11-13 07:04:42 -05:00
parent c785724655
commit 3262e038f6

View file

@ -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;
}
}());
}());