[no subject]



       %U     The week number of the current year  as  a  decimal
              number,  range  00  to  53, starting with the first
              Sunday as the first day of week 01. See also %V and
              %W.

       %W     The week number of the current year  as  a  decimal
              number,  range  00  to  53, starting with the first
              Monday as the first day of week 01.

As far as I can tell, your test program shows that this behavior
(whether it is the optimal behavior or not) is implemented by
g_date_get_{sunday,monday}_week_of_year.

Now since I originally implemented those week-of-year calculations way
back when, a third option such has appeared:

       %V     The  ISO  8601:1988 week number of the current year
              as a decimal number, range 01 to 53, where  week  1
              is  the  first week that has at least 4 days in the
              current year, and with Monday as the first  day  of
              the week. See also %U and %W. (SU)

...which seems to be what you are talking about.

So it would probably be a good idea to add a new function to GDate (is
it too late for that?) called "g_date_get_iso8601_week_of_year", or
maybe just "g_date_get_week_of_year", that would use the ISO8601 method.

-JT






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]