[MDEV-21381] week() and ISO 8601 Created: 2019-12-22  Updated: 2019-12-24  Resolved: 2019-12-24

Status: Closed
Project: MariaDB Server
Component/s: Temporal Types
Affects Version/s: 5.5, 10.1, 10.2, 10.3, 10.4
Fix Version/s: N/A

Type: Bug Priority: Minor
Reporter: miracee Assignee: Alexander Barkov
Resolution: Fixed Votes: 0
Labels: upstream
Environment:

all



 Description   

I tested ISO 8601 behavior on PostgreSQL and MariaDB:
PostgreSQL:
SELECT EXTRACT (WEEK from '2019-12-30'::date) => 1
MariaDB:
SELECT WEEK('2019-12-30') => 52

I published result.

Andrew Hutchings answered:
Beat me to it �. We should maybe update the week doc to mention mode 3 is 8601

So, here is the ticket, to forget it.



 Comments   
Comment by Elena Stepanova [ 2019-12-23 ]

Same with all MySQL versions.
bar, what do you think?

Comment by Alexander Barkov [ 2019-12-24 ]

In order to get ISO 8601 week numbering, please use WEEK(date,3):

SELECT WEEK('2019-12-30',3);

+----------------------+
| WEEK('2019-12-30',3) |
+----------------------+
|                    1 |
+----------------------+

I have updated the manual at https://mariadb.com/kb/en/week/

Generated at Thu Feb 08 09:06:42 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.