为什么weekofyear(2022.01.01)=52

请先 登录 后评论

1 个回答

mhxiang

weekofyear(x)计算x在当年的第几个星期,这里是ISO的日期格式,其中每个星期是从周日开始的,返回的结果是整型

The last week of the ISO week-numbering year, i.e. the 52nd or 53rd one, is the week before week 01. This week’s properties are:
It has the year's last Thursday in it.
It is the last week with a majority (4 or more) of its days in December.
Its middle day, Thursday, falls in the ending year.
Its last day is the Sunday nearest to 31 December.
It has 28 December in it. Hence the earliest possible last week extends from Monday 22 December to Sunday 28 December, the latest possible last week extends from Monday 28 December to Sunday 3 January (next gregorian year).

If 31 December is on a Monday, Tuesday or Wednesday, it is in week 01 of the next year. If it is on a Thursday, it is in week 53 of the year just ending; if on a Friday it is in week 52 (or 53 if the year just ending is a leap year); if on a Saturday or Sunday, it is in week 52 of the year just ending.



请先 登录 后评论
  • 1 关注
  • 0 收藏,813 浏览
  • haaha 提出于 2022-04-26 16:45

相似问题