Re: Need beginning and ending date value for a particular week in the year
В списке pgsql-general по дате отправления:
| От | John R Pierce |
|---|---|
| Тема | Re: Need beginning and ending date value for a particular week in the year |
| Дата | |
| Msg-id | 4A1C3293.9040101@hogranch.com обсуждение исходный текст |
| Ответ на | Need beginning and ending date value for a particular week in the year (Keaton Adams <kadams@mxlogic.com>) |
| Ответы |
Re: Need beginning and ending date value for a particular
week in the year
|
| Список | pgsql-general |
> So for the calculated week value (i.e. 2009w22) I need to be able to > calculate the first and last day of the week (05/25/2009 and > 05/31/2009). Is there a clean / fairly easy way to do this? I can > think of doing some string comparisons and walking through date values > to figure it out but was wondering if there was a rather simplistic > way to do this that I am overlooking. well, a few things that come to mind..... figure out how many days are in the first partial week prior to week 1 of this year, that would be something like 7 - day_of_week(YYYY-01-01), then take '1 day'::interval * (week-1)*7 + that offset, and add that to YYYY-01-01 ... add '6 day'::interval to get the last day of the week...
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера