On Monday 16 February 2004 15:10, you wrote: > > Any idea on how to find the 3 rd Wednesday of any given month.
SELECT 1-(to_char(date_trunc('month', now()::timestamp),'D'))::INT2 + 7*3-3 replace now with any date and you'll the the day number of a third Wed in that month. 7 is a constant (factor 3 is a desired week number) -3 is number of days to step back from sunday to a desired day of week (-3 stands for Wed) ---------------------------(end of broadcast)--------------------------- TIP 9: the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match