Re: just to laugh
"Lyle H. Gray" <[email protected]> Fri, 28 Aug 2020 11:17:57 -0500
| Newsgroups | comp.databases.mysql |
|---|---|
| Message-ID | <[email protected]> |
"Lyle H. Gray" <[email protected]> wrote in news:[email protected]: > Ammammata <[email protected]> wrote in > news:[email protected]: > >> tried this with MS SQL >> >> select DATEPART(wk, '20210101') >> select DATEPART(wk, '20210102') >> select DATEPART(wk, '20210103') >> select DATEPART(wk, '20210104') >> select DATEPART(wk, '20210105') >> select DATEPART(wk, '20210106') >> >> result >> >> 1 >> 1 >> 2 >> 2 >> 2 >> 2 >> >> https://en.wikipedia.org/wiki/ISO_8601#Week_dates > > And if you use the YEARWEEK() function in MySQL, you get the ISO 8601 > standard results (including the year). > > You've pointed out that MS SQL Server does not use the ISO 8601 > standard for the definition of the week number. I will also note that you can define the first day of the week using SET DATEFIRST in MS SQL, which probably explains (at least in part) why it does not conform to the ISO 8601 standard. Try your experiment again using DATEPART(isowk,<date>) instead of DATEPART (wk,<date>).