| From: | Feike Steenbergen <feikesteenbergen(at)gmail(dot)com> |
|---|---|
| To: | "Shulgin, Oleksandr" <oleksandr(dot)shulgin(at)zalando(dot)de> |
| Cc: | kees(dot)westerlaken(at)valuecare(dot)nl, Pg Bugs <pgsql-bugs(at)postgresql(dot)org> |
| Subject: | Re: BUG #13845: Incorrect week number |
| Date: | 2016-01-05 13:32:43 |
| Message-ID: | CAK_s-G2b=rtj99RNXj8mQzLbQUsZ12bMsg8yEEYdAssj7K5gmw@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-bugs |
If I read and understand the documentation correctly, WW starts on the
first day of the year, therefore January 1 - 7 is week 01.
The following query seems to confirm this on 9.4, I'm looking for the week
number for day 7 of the year:
# # select to_char(day, 'YYYYWW') as week, to_char(day, 'IYYYIW') as
isoweek from generate_series('2008-01-07','2020-01-07', interval '1 year')
as series(day);
week | isoweek
--------+---------
200801 | 200802
200901 | 200902
201001 | 201001
201101 | 201101
201201 | 201201
201301 | 201302
201401 | 201402
201501 | 201502
201601 | 201601
201701 | 201701
201801 | 201801
201901 | 201902
202001 | 202002
(13 rows)
According to wikipedia, the US weeks starts on a Sunday, it would already
have resulted in differences when using the WW format for weeks in the
past, as WW starts on day 1, whether it is Sunday or Wednesday.
regards,
Feike
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Marek.Petr | 2016-01-05 13:46:25 | Re: BUG #13822: Slave terminated - WAL contains references to invalid page |
| Previous Message | Shulgin, Oleksandr | 2016-01-05 11:11:54 | Re: BUG #13845: Incorrect week number |