Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Oracle Add 1 hour in SQL

I am just trying to add 1 hour to a value, it is kind of complicated on where and why i am doing this but basically i just need to query something like this

select DATE_ADD(hh,1,'2014-10-15 03:30:00 pm') from dual

I keep reading old articles that say to use dateAdd or date_add but I keep getting invalid identifier errors.

like image 841
Travis Avatar asked Sep 03 '25 14:09

Travis


1 Answers

select sysdate + 1/24 from dual;

sysdate is a function without arguments which returns DATE type
+ 1/24 adds 1 hour to a date

select to_char(to_date('2014-10-15 03:30:00 pm', 'YYYY-MM-DD HH:MI:SS pm') + 1/24, 'YYYY-MM-DD HH:MI:SS pm') from dual;
like image 94
Multisync Avatar answered Sep 05 '25 02:09

Multisync