How to determine which day is the first in week in current locale in C.
In Russia monday is the first day, but my mac shows localized calendar with wrong first day.
So i wonder if i can determine which day is the first in current locale. Thanks.
anatoly@mb:/Users/anatoly$ cal
Июля 2012
вс пн вт ср чт пт сб
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31
I was wrong in my first post, and ICU provides a C API.
So, if dependency on that library is acceptable for you, you can get the first of the week portably using the following snippet:
Then you link the program with
icu-i18npkg-config library.Ah, and they have quite an extensive example printing a calendar, if you might be interested.