Daily Archives: February 21, 2011

USEFUL NETEZZA DATE FUNCTIONS:

SELECT date(current_Date) from dual; –10/28/10 (if current date is Oct 28, 2010) SELECT (current_timestamp) from dual; /* SELECT DATE_PART(‘MONTH’,current_date)from dual; SELECT current_time, DATE_PART(‘SECOND’,current_time)from dual; SELECT current_timestamp, DATE_PART(‘SECOND’,current_timestamp) from dual;*/ select add_months(current_date,-1) from dual; — DATE_TRUNC FUNCTION: SELECT add_months (date_trunc(‘month’, current_timestamp),-1) from dual; select add_months (date_trunc(‘month’, current_date),-1) from dual; –ADD_MONTHS FUNCTION: select add_months(current_date,-1) – date_part(‘day’, current_date)… Read More »