Hi, Samuel Thibault, le Wed 08 Feb 2006 00:41:00 +0100, a écrit : > - you can get first day of the week: > unsigned first = * (unsigned char *) nl_langinfo(_NL_TIME_FIRST_WEEKDAY); > (1 is sunday).
This is not so easy, actually. Stricly speaking, _NL_TIME_FIRST_WEEKDAY doesn't return an absolute day number, but a day number relatively to the day of _NL_TIME_WEEK_1STDAY: for instance, with a en_US locale, (int) nl_langinfo(_NL_TIME_WEEK_1STDAY) returns 19971130 as "first day of week system", which is a Sunday. And * nl_langinfo(_NL_TIME_FIRST_WEEKDAY) returns 1, which means "the first day of the week system", hence Sunday. With a fr_FR locale, (int) nl_langinfo(_NL_TIME_WEEK_1STDAY) returns 19971130 too (hence the first day of the week system is a Sunday too) and * nl_langinfo(_NL_TIME_FIRST_WEEKDAY) returns 2, which means 'the second day of the week system', hence Monday. Why such complexity? Because there may be other week systems, and there are: ISO/IEC 14652 sets _NL_TIME_WEEK_1STDAY to 19971201, which is a monday, and hence if in some locale * nl_langinfo(_NL_TIME_FIRST_WEEKDAY) returns 1, that means a monday (since the first day of the week system is 19971201, a monday). Plus there may be week systems where the number of days is not 7, so * nl_langinfo(_NL_TIME_WEEK_NDAYS) should be used for getting the number of days in a week, and then compute and display week days accordingly. Finally, there is * nl_langinfo(_NL_TIME_CAL_DIRECTION) that returns the direction of the days in a calendar: 1 : left-right from top 2 : top-down from left 3 : right-left from top Regards, Samuel -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]