The strftime directive "%V" will get you what you want:
>>> import datetime
>>> datetime.date(2019,7,10).strftime("%V")
'28'
>>> datetime.date(2019,7,10).strftime("%W")
'27'
-tk
On Wed, Jul 10, 2019 at 7:40 AM Ferran Vidal Marginet <
[email protected]> wrote:
> Hello,
>
> Today, 10th of July according to my Outlook calendar seems to be week 28
> but the "%W" format in Weewx shows week 27. In general this year this
> format shows one more week than Excel/Outlook/etc.
>
> Somebody knows why? Shouldn't follow ISO8610?
> https://en.wikipedia.org/wiki/ISO_8601
>
> In this thread (
> https://groups.google.com/forum/#!msg/weewx-user/funRVI-T_p0/e58oZtK6AwAJ)
> says that week number follow the following rule:
>
> %W Week number of the year (Monday as the first day of the week) as a
> decimal number [00,53]. All days in a new year preceding the first Monday
> are considered to be in week 0.
>
> and this is not the same as ISO8610. Why? How can I get the same week
> number as ISO8610? The rule that ISO follows is:
>
> There are several mutually equivalent and compatible descriptions of week
> 01:
>
>
> - the week with the year's first Thursday in it (the formal ISO
> definition),
> - the week with 4 January in it,
> - the first week with the majority (four or more) of its days in
> the starting year, and
> - the week starting with the Monday in the period 29 December – 4
> January.
>
> Acording to this today, 10th of July of 2019 is W28.
>
> Thanks,
> Ferran
>
> --
> You received this message because you are subscribed to the Google Groups
> "weewx-user" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/weewx-user/97d6b0f5-d717-4e51-8620-82b31c86c4c0%40googlegroups.com
> <https://groups.google.com/d/msgid/weewx-user/97d6b0f5-d717-4e51-8620-82b31c86c4c0%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
--
You received this message because you are subscribed to the Google Groups
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/weewx-user/CAPq0zEB1hkxRSCeSprEArVZpN7SmROtjoRiH1hM7vF5peuVSSw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.