Dia da semana após o Gresql
select extract(dow from date '2016-12-18'); /* sunday */
Black Buffalo
select extract(dow from date '2016-12-18'); /* sunday */
select to_char(current_date, 'IYYY-IW');