Sunday, March 20, 2022

Date Function is SAP HANA

 

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'




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

2315907 - Starting HANA automatically after Host has been started

  Symptom By default the SAP HANA database is configured so that it is not started automatically when the SAP HANA host is rebooted. Environ...