Search Postgresql Archives

Re: extract (dow/week from date)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Stephan Szabo <sszabo@xxxxxxxxxxxxxxxxxxxxx> writes:
> I think something like:
> (CASE WHEN extract(dow from date) = 0 THEN 7 else extract(dow from date))

It's really not that hard:

	(extract(dow from date) + 6) % 7

You can rotate to any week-start day you like by substituting different
things for "6".

			regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux