zhanying <pytho...@126.com> added the comment:

i read the source code, in this part

def _calc_julian_from_U_or_W(year, week_of_year, day_of_week, week_starts_Mon):
"""Calculate the Julian day based on the year, week of the year, and day of
    the week, with week_start_day representing whether the week of the year
    assumes the week starts on Sunday or Monday (6 or 0)."""
first_weekday = datetime_date(year, 1, 1).weekday()
# If we are dealing with the %U directive (week starts on Sunday), it's
    # easier to just shift the view to Sunday being the first day of the
    # week.
if not week_starts_Mon:
        first_weekday = (first_weekday + 1) % 7
day_of_week = (day_of_week + 1) % 7
# Need to watch out for a week 0 (when the first day of the year is not
    # the same as that specified by %U or %W).
week_0_length = (7 - first_weekday) % 7
if week_of_year == 0:
return 1 + day_of_week - first_weekday
else:
        days_to_week = week_0_length + (7 * (week_of_year - 1))
return 1 + days_to_week + day_of_week

when first_weekday is 0, that year start with Monday, week_of_year equar 0 or 
1, this func return same value

At 2020-04-09 20:45:51, "Eric V. Smith" <rep...@bugs.python.org> wrote:
>
>Eric V. Smith <e...@trueblade.com> added the comment:
>
>Can you tell us what platform you're on? Also, please include the header 
>that's printed out when you run python from the command line. For example, 
>mine shows:
>
>$ python3
>Python 3.7.6 (default, Jan 30 2020, 10:29:04) 
>[GCC 9.2.1 20190827 (Red Hat 9.2.1-1)] on linux
>
>----------
>components: +Library (Lib)
>nosy: +eric.smith
>
>_______________________________________
>Python tracker <rep...@bugs.python.org>
><https://bugs.python.org/issue40236>
>_______________________________________

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue40236>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to