Add Day to Timestamp

前端 未结 2 1818
灰色年华
灰色年华 2021-01-17 11:25

How do I add days to a timestamp? If my timestamp is 01-JAN-2011 11-09-05 and I add 2 days, I want 03-JAN-2011 11-09-05.

相关标签:
2条回答
  • 2021-01-17 11:41

    A completely Oracle-centric solution is to simply add 2 to the timestamp value as the default interval is days for Oracle dates/timestamps:

    SELECT TO_TIMESTAMP('01-jan-2011 11-09-05','DD-Mon-YYYY HH24-MI-SS') + 2
      FROM dual;
    
    0 讨论(0)
  • 2021-01-17 11:59
    select '01-jan-2011 11-09-05' + interval '2' day
    
    0 讨论(0)
提交回复
热议问题