Difference between revisions of "DATE BUILT IN FUNCTIONS"

From rbachwiki
Jump to navigation Jump to search
(Created page with "==MONTHS_BETWEEN() - RETURNS THE NUMBER OF MONTHS BETWEEN 2 DATES== MONTHS_BETWEEN('01-MAR-15','01-JAN-15')=2 ==ADD_MONTHS() - ADDS MONTHS TO A DATE == ADD_MONTHS('01-MAR-1...")
 
 
(2 intermediate revisions by the same user not shown)
Line 3: Line 3:


==ADD_MONTHS() - ADDS MONTHS TO A DATE ==
==ADD_MONTHS() - ADDS MONTHS TO A DATE ==
  ADD_MONTHS('01-MAR-15',3)='31-MAR-15'
  ADD_MONTHS('01-MAR-15',3)='01-JUN-15'


==LAST_DAY() - RETURNS THE LAST DAY OF THE MONTH==
==LAST_DAY() - RETURNS THE LAST DAY OF THE MONTH==
Line 10: Line 10:
==NEXT_DAY() - RETURNS THE NEXT DAY MENTIONED IN THE ARGUMENT ==
==NEXT_DAY() - RETURNS THE NEXT DAY MENTIONED IN THE ARGUMENT ==
  NEXT_DAY('01-MAR-15','WEDNESDAY')='04-MAR-15'
  NEXT_DAY('01-MAR-15','WEDNESDAY')='04-MAR-15'
===DATE CONVERSION TO CHARACTER DATA ===
SELECT TO_CHAR(HIRE_DATE, 'Month dd, YYYY') output -> June 07, 1994
SELECT TO_CHAR(HIRE_DATE, fmMonth dd, YYYY') output -> June 7 1994
SELECT TO_CHAR(HIRE_DATE, 'fmMonth ddth, YYYY') output -> June 7th, 1994
SELECT TO_CHAR(SYSDATE, 'hh:mm')output-> 02:07
SELECT TO_CHAR(SYSDATE, 'hh:mm pm') output -> 02:07 am
SELECT TO_CHAR(SYSDATE, 'hh:mm:ss pm') output-> 02:07:23 am


[[#Select Command|Back To Top]]-[[Main_Page| Home]] - [[Oracle_SQL|Category]]
[[#Select Command|Back To Top]]-[[Main_Page| Home]] - [[Oracle_SQL|Category]]

Latest revision as of 18:45, 19 November 2017

MONTHS_BETWEEN() - RETURNS THE NUMBER OF MONTHS BETWEEN 2 DATES

MONTHS_BETWEEN('01-MAR-15','01-JAN-15')=2

ADD_MONTHS() - ADDS MONTHS TO A DATE

ADD_MONTHS('01-MAR-15',3)='01-JUN-15'

LAST_DAY() - RETURNS THE LAST DAY OF THE MONTH

LAST_DAY('01-MAR-15')='31-MAR-15'

NEXT_DAY() - RETURNS THE NEXT DAY MENTIONED IN THE ARGUMENT

NEXT_DAY('01-MAR-15','WEDNESDAY')='04-MAR-15'

DATE CONVERSION TO CHARACTER DATA

SELECT TO_CHAR(HIRE_DATE, 'Month dd, YYYY') output -> June 07, 1994
SELECT TO_CHAR(HIRE_DATE, fmMonth dd, YYYY') output -> June 7 1994
SELECT TO_CHAR(HIRE_DATE, 'fmMonth ddth, YYYY') output -> June 7th, 1994
SELECT TO_CHAR(SYSDATE, 'hh:mm')output-> 02:07
SELECT TO_CHAR(SYSDATE, 'hh:mm pm') output -> 02:07 am
SELECT TO_CHAR(SYSDATE, 'hh:mm:ss pm') output-> 02:07:23 am

Back To Top- Home - Category