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

 

The SYSDATE pseudo-column shows the current system date and time.

Example:-

--Next 5 hours SQL> select to_char(sysdate,'DD/MM/YYYY HH24:MI:SS'),to_char(sysdate + 300/1440,'DD/MM/YYYY HH24:MI:SS') FROM DUAL;

TO_CHAR(SYSDATE,'DD TO_CHAR(SYSDATE+300
------------------- -------------------
07/12/2012 11:44:08 07/12/2012 16:44:08

--Back 5 hours SQL> select to_char(sysdate,'DD/MM/YYYY HH24:MI:SS'),to_char(sysdate - 300/1440,'DD/MM/YYYY HH24:MI:SS') FROM DUAL;

TO_CHAR(SYSDATE,'DD TO_CHAR(SYSDATE-300
------------------- -------------------
07/12/2012 11:49:59 07/12/2012 06:49:59

–5  hours from now    SYSDATE + 300/1440
–10 minutes from now    SYSDATE + 10/1440
–30 seconds from now    SYSDATE + 30/86400

More Explore

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s