1. Introduction
In this short article, we will present a way to add and subtract minutes to an Oracle date column.
2. Add minutes to an Oracle date
To add minutes to an Oracle date column we can simply use +
operator like in the following example:
sysdate + 1 is exactly one day ahead - 24 hours,
/ 1440 divide the # of minutes in a day,
multiply by 15 to get the 15 minutes ahead.
Query used in the above example will produce the following result (for sysdate = '2019-10-16 23:32:45');
SYSDATE | SYSDATE + (1/1440*15) |
2019-10-16 23:32:45 | 2019-10-16 23:47:45 |
The other method to add minutes to an Oracle date is to use interval command:
3. Subtract minutes from Oracle date
To get 15 minutes earlier date use the following query:
4. Conclusion
In this article, we presented how to add and subtract minutes to the DATE in Oracle. Luckily Oracle provides an easy way to achieve that simply by using mathematic operators like plus '+' and minus '-'.
{{ 'Comments (%count%)' | trans {count:count} }}
{{ 'Comments are closed.' | trans }}