Formatage de dates

Petit mémo sur la notation de formats de dates dans différents languages de programmation.

Symboles de fromatage de dates.
- Java PHP js Py (ex.)
Era designator G AD
Year yyyyy Y YYYY %Y 1999, 2003
Year yy y %y 99, 03
Week year Y 2009; 09
Month in year MM m MM %m 01-12
Month in year n 1-12
Month in year MMM M %b Jan-Dec
Month in year MMMM F %B January-December
Week in year w W %W 27
Week in month W 2
Day in year D z %j 0-365
Day in month dd d DD %d 01-31
Day in month j 1-31
Day of week in month F 2
Day name in week EEE %a Tue
Day name in week EEEE l %A Tuesday
Day number of week u N %w 1
Am/pm marker a a %p am, pm
Am/pm marker A AM, PM
Hour in day (0-23) HH HH %H 0
Hour in day (1-24) k 24
Hour in am/pm (0-11) K 0
Hour in am/pm (1-12) h %I 12
Minute in hour mm mm %M 30
Second in minute ss ss %S 55
Millisecond SSS sss %f 978
  • java  : 1 = Monday, ..., 7 = Sunday
  • php  : 1 = Monday, ..., 7 = Sunday
  • python: 0 = Sunday, ..., 6 = Saturday
Ordre des jours dans différents languages.

Ecma-262 Edition 5.1, The ECMAScript Language Specification. ecma-international.org, . 15.9.1.15 Date Time String Format

Java Platform, Standard Edition 7 API Specification. docs.oracle.com, . Class SimpleDateFormat

PHP Manual. php.net, . date

The Python Standard Library. docs.python.org, . 8.1.7. strftime() and strptime() Behavior