How to subtract hours from a date in Oracle so it affects the day also

前端 未结 5 1966
暗喜
暗喜 2021-02-01 17:23

I\'m trying to subtract date from Oracle so it even effect the day as well. For example, if the timestamp is 01/June/2015 00 hours and if I subtract 2 hours, I want to be able

5条回答
  •  孤城傲影
    2021-02-01 18:07

    sysdate-(2/11)

    A day consists of 24 hours. So, to subtract 2 hours from a day you need to divide it by 24:

    DATE_value - 2/24
    

    Using interval for the same:

    DATE_value - interval '2' hour
    

提交回复
热议问题