Hello everyone,
While looking at bug 6596, I started wondering why we didn't have more options to print dates (and/or their parts). I've gathered "date formats" printing options from various sources and started implementing all those different formats and options.
I have implemented 6 new methods to print the different date components/parts/timespans.
Do you think this stuff would be useful? Anything missing?
Here are the supported format options I came up with. Most of them are already implemented, now it's just a matter of writing the numerous missing unit tests! ;)
Comments, complaints and suggestions are welcome!
a) Year formats (#printYearWithFormat:)
May 14, -7
May 14 2002
1-Year, signed (-7 and 2002)
2-Year, last 2 digits, signed (-07 and 02)
3-Year, last 3 digits, signed (-007 and 002)
4-Year, last 4 digits or more digits if year is greater than 9999, signed (-0007 and 2002)
5-Year, unsigned (7 and 2002)
6-Year, last 2 digits, unsigned (07 and 02)
7-Year, last 3 digits, unsigned (007 and 002)
8-Year, last 4 digits or more digits if year is greater than 9999, unsigned (0007 and 2002)
9-Year in roman numerals (n/a and MMII)
10-Year (full, no padding) with epoch AD/BC (7 BC and 2002 AD)
11-Year (full, no padding) with epoch A.D./B.C. (7 B.C. and 2002 A.D.)
12-Year (full, no padding) with epoch ad/bc
(7 bc and 2002 ad)
13-Year (full, no padding) with epoch a.d./b.c. (7 b.c. and 2002 a.d.)
b) Month formats (#printMonthWithFormat:)
Tuesday, September 18 2012
1-Month , no padding (9)
2-Month padded to 2 digits (09)
3-Month name abreviation (Sep)
4-Month name (September)
5-Month name abreviation in uppercase (SEP)
6-Month name in uppercase (SEPTEMBER)
7-Month name abreviation in lowercase (sep)
8-Month name in lowercase (september)
9-Month number in Roman numerals (IX)
c) Day formats (#printDayWithFormat:)
Saturday, December 1 2012
1-Day of the month, no padding (1)
2-Day of the month padded to 2 digits (01)
3-Abbreviated day of week (Sat)
4-Complete day of week (Saturday)
5-Abbreviated day of week in uppercase (SAT)
6-Complete day of week in uppercase (SATURDAY)
7-Abbreviated day of week in lowercase (sat)
8-Complete day of week lowercase
(saturday)
9-Day of the month with english suffix (1st)
10-Day of the year (336)
11-Day of the year with English suffix (336th)
12-Day of the week index [0=sunday 6 = saturday] (6)
13-Day of the week index [1=sunday 7 = saturday] (7)
14-Day of the week index [0=monday 6 = sunday] (5)
15-Day of the week index [1=monday 7 = sunday] (6)
16-Julian day, i.e. days since January 1, 4712 BC (2456263)
d) Week formats (#printWeekWithFormat:)
1-Week of the year (1..53) where Sunday if the first day of the week
2-Week of the year (1..53) where Monday if the first day of the week
e) Era formats (#printEraWithFormat:)
1-Era AD or BC
2-Era A.D. or B.C.
3-Era ad or bc
4-Era a.d. or b.c.
f) Century formats (#printCenturyWithFormat:)
1-Century (20)
2-Century with English suffix (20th)
-----------------
Benoit
St-Jean
Yahoo! Messenger: bstjean
A standpoint is an intellectual horizon of radius zero.
(Albert Einstein)