DateAdd function in pl / sql

As the name implies, I'm looking for a function in pl / sql that does something similar, like the DateAdd function. I searched and I found the add_months function, but I would really like it to be a little more variable, since I need to add minutes, hours, days, etc.

+3
source share
2 answers

There are not many solutions here:

PL / SQL allows arithmetic to be performed directly on date variables. You can add numbers to a date or subtract numbers from a date. To reschedule a date one day in the future, simply add 1 to the date, as shown below:

hire_date + 1

. , 1/24 . 1/(24 * 60) ..

+3

- - :

date1 := date2 + interval '1' day;
date1 := date2 + interval '2' month;
date1 := date2 + interval '3' year;

, .

+6

Source: https://habr.com/ru/post/1771261/


All Articles