Calculate days between two Dates
SELECT DAYS_BETWEEN (TO_DATE ('2009-12-05', 'YYYY-MM-DD'), TO_DATE('2010-01-05', 'YYYY-MM-DD')) "days between" FROM DUMMY;
calculate days between dates and current date
SELECT
ORDR."DocNum",
ORDR."CardCode",
ORDR."CardName",
ORDR."DocDate",
ORDR."DocStatus",
DAYS_BETWEEN (TO_DATE (ORDR."DocDate"), TO_DATE(CURRENT_DATE)) "days between"
FROM ORDR
where DAYS_BETWEEN (TO_DATE (ORDR."DocDate"), TO_DATE(CURRENT_DATE))>=180 and ORDR."DocStatus"='O'
ORDR."DocNum",
ORDR."CardCode",
ORDR."CardName",
ORDR."DocDate",
ORDR."DocStatus",
DAYS_BETWEEN (TO_DATE (ORDR."DocDate"), TO_DATE(CURRENT_DATE)) "days between"
FROM ORDR
where DAYS_BETWEEN (TO_DATE (ORDR."DocDate"), TO_DATE(CURRENT_DATE))>=180 and ORDR."DocStatus"='O'
Calculate Months between two Dates
SELECT MONTHS_BETWEEN(TO_DATE ('2003-01-01'), TO_DATE('2003-03-14')) "months_between" FROM DUMMY;
No comments:
Post a Comment