Equivalent function for DATEADD() in Oracle

后端 未结 4 1872
时光说笑
时光说笑 2020-12-03 07:07

I have to get a date that is 6 months from the system date in Oracle.
And I have to get it by running an open-query from SQL. DATEADD(MONTH,-6, GETDATE())

4条回答
  •  感动是毒
    2020-12-03 07:44

    Method1: ADD_MONTHS

    ADD_MONTHS(SYSDATE, -6)

    Method 2: Interval

    SYSDATE - interval '6' month

    Note: if you want to do the operations from start of the current month always, TRUNC(SYSDATE,'MONTH') would give that. And it expects a Date datatype as input.

提交回复
热议问题