Question: What do I do to add five hours to an Oracle DATE column?
How can I add hours to a date/time format?
Answer: To add hours to an Oracle date you can use this simple query:
select sysdate, sysdate + (1/24*5) "5 hours" from dual;
The formula (1/24*5) is explained as follows:
You can also add 5 hours to a date this way: (60 * 5)
As we see, there are several ways to add hours to an Oracle date column.
Answer: To add hours to an Oracle date you can use this simple query:
select sysdate, sysdate + (1/24*5) "5 hours" from dual;
The formula (1/24*5) is explained as follows:
- sysdate + 1 is one day ahead (exactly 24 hours)
- - divided by 24 gives one hour
- * 5 multiply by 5 to get the 5 hours
You can also add 5 hours to a date this way: (60 * 5)
As we see, there are several ways to add hours to an Oracle date column.
No comments:
Post a Comment