1. Add Date
select (sysdate)+1 from dual;
2. Add Months
select add_months(sysdate, 2) from dual;
or Minus Months
select add_months(sysdate, -2) from dual;
3. Return Date Format
a. select sysdate from dual -- return 10/19/2011 4:49:02 PM
b. select to_char(sysdate, 'day') from dual -- return 'monday'
c. select to_char(sysdate, 'DAY') from dual -- return 'MONDAY'
d. select to_char(sysdate, 'dd-mm-yyyy') from dual -- return 29-10-2011
e. select to_date(sysdate) from dual -- return 19-OCT-2011
f. select to_char(sysdate, 'd') from dual -- return numeric day of week.
-- For eg : Wednesday = 4
g. select to_char(sysdate, 'dd') from dual -- return date only
h. select to_char(sysdate, 'dd-mm') from dual -- return date and month.
No comments:
Post a Comment