I believe you can use this function:
The function in the case returns the day of the week, 7 is Sunday.
date is my column containing the dates.
SELECT EXTRACT(ISODOW FROM data_admissao)
FROM tb_empregado
WHERE EXTRACT(ISODOW FROM data_admissao) =7
The function: date_trunc('day', NOW() - interval '6 month')
will return you the date 6 months ago.
Updating:
I tested it here and you can filter it the way I informed you
Follow an example:
SELECT *
FROM tb_empregado
WHERE EXTRACT(ISODOW FROM data_admissao) =7
AND data_admissao <date_trunc('day', NOW() - interval '6 month')
//Função responsável por retornar o dia da semana da data inserida, no caso a coluna
EXTRACT(ISODOW FROM data_admissao)
Party responsible for returning the current date - 6 months
date_trunc('day', NOW() - interval '6 month')
was convinced that the function only received whole, very cool =] vlw
– Rovann Linhalis
Postgresql has evolved a lot in the last few years ;o)
– Lacobus