top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Oracle: How does one add a day/hour/minute/second to a date value?

+1 vote
363 views
Oracle: How does one add a day/hour/minute/second to a date value?
posted Jun 17, 2015 by Archana

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes
-- # Add a day

select  to_char(sysdate,'dd-mm-yyyy hh24:mi:ss') "Todays-date" , to_char(sysdate +1,'dd-mm-yyyy hh24:mi:ss') One_day  from dual ;


Todays-date         ONE_DAY
------------------- -------------------
05-01-2012 12:55:52 06-01-2012 12:55:52


-- # Add an hour

select  to_char(sysdate,'dd-mm-yyyy hh24:mi:ss')  "Todays-date" , to_char(sysdate +1/24,'dd-mm-yyyy hh24:mi:ss') One_hour from dual ;


Todays-date         ONE_HOUR
------------------- -------------------
05-01-2012 12:56:06 05-01-2012 13:56:06


-- # Add an Minute

select  to_char(sysdate,'dd-mm-yyyy hh24:mi:ss') "Todays-date" , to_char(sysdate +1/(24*60),'dd-mm-yyyy hh24:mi:ss') One_minute from dual ;


Todays-date         ONE_MINUTE
------------------- -------------------
05-01-2012 12:56:18 05-01-2012 12:57:18



-- # Add Second

select  to_char(sysdate,'dd-mm-yyyy hh24:mi:ss') "Todays-date" , to_char(sysdate +1/(24*60*60),'dd-mm-yyyy hh24:mi:ss') One_second from dual ;


Todays-date         ONE_SECOND
------------------- -------------------
05-01-2012 12:56:27 05-01-2012 12:56:28
answer Jun 18, 2015 by Shivaranjini
...