mirror of
https://github.com/samsonjs/strftime.git
synced 2026-03-25 09:05:48 +00:00
Added %j and %C
This commit is contained in:
parent
c785724655
commit
3262e038f6
1 changed files with 8 additions and 1 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
}());
|
||||
}());
|
||||
|
|
|
|||
Loading…
Reference in a new issue