Pages

Google Ads

Sunday, June 21, 2009

Somar 30 dias a data atual no PostgreSQL, Oracle e MySQL

Amigo leitor,

No PostgreSQL ficaria:

SELECT current_date as diaatual, current_date + 30 as diaatualmais30dias

No Oracle:
SELECT SYSDATE, SYSDATE + 30 FROM DUAL;

No MySQL:

Select DATE_ADD(CURDATE(), INTERVAL 20 DAY)

Select CURDATE() + INTERVAL 20 DAY

Select NOW() + INTERVAL 20 DAY

Select replace(CURDATE() + INTERVAL 20 DAY, "-", "")

No comments: