简体   繁体   English

为什么从 current_date 中提取周给出错误的周数

[英]Why is extract week from current_date giving wrong week number

select extract(week from current_date) is giving 16 but current ISO week is 17. Is this a bug or am I doing something wrong? select extract(week from current_date)给出 16 但当前 ISO 周是 17。这是一个错误还是我做错了什么? Last week it worked OK.上周它工作正常。

You might be looking for:您可能正在寻找:

extract(isoweek from current_date)

As per the documentation :根据文档

WEEK : Returns the week number of the date in the range [0, 53] . WEEK :返回[0, 53]范围内日期的周数。 Weeks begin with Sunday, and dates prior to the first Sunday of the year are in week 0.周从星期日开始,一年中第一个星期日之前的日期在第 0 周。

ISOWEEK : Returns the ISO 8601 week number of the date_expression. ISOWEEK :返回 date_expression 的ISO 8601 周数。 ISOWEEK s begin on Monday. ISOWEEK从星期一开始。 Return values are in the range [1, 53] .返回值在[1, 53]范围内。 The first ISOWEEK of each ISO year begins on the Monday before the first Thursday of the Gregorian calendar year.每个 ISO 年的第一个ISOWEEK从公历年第一个星期四之前的星期一开始。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM