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? 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]
. Weeks begin with Sunday, and dates prior to the first Sunday of the year are in week 0.
ISOWEEK
: Returns the ISO 8601 week number of the date_expression.ISOWEEK
s begin on Monday. Return values are in the range[1, 53]
. The firstISOWEEK
of each ISO year begins on the Monday before the first Thursday of the Gregorian calendar year.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.