How To Add Day, Hour, Minute, Second to a Date Value in Oracle
2012-05-04 11:05
477 查看
Add a day.
select to_date('02-22-2008 10:30:30','mm-dd-yyyy hh24:mi:ss') today,
to_date('02-22-2008 10:30:30','mm-dd-yyyy hh24:mi:ss')+1 next_day
from dual;
TODAY NEXT_DAY
------------------------- -------------------------
02-22-08 10:30:30 02-23-08 10:30:30
Add an hour.
select to_date('02-22-08 10:30:30','mm-dd-yy hh24:mi:ss') today,
to_date('02-22-08 10:30:30','mm-dd-yy hh24:mi:ss')+ 1/24 next_hour
from dual;
TODAY NEXT_HOUR
------------------------ ------------------------
02-22-08 10:30:30 02-22-08 11:30:30
Add a minute.
select to_date('02-22-08 10:30:30','mm-dd-yy hh24:mi:ss') today,
to_date('02-22-08 10:30:30','mm-dd-yy hh24:mi:ss')+ 1/(24*60) next_min
from dual;
TODAY NEXT_MIN
------------------------ ------------------------
02-22-08 10:30:30 02-22-08 10:31:30
Add a second.
select to_date('02-22-08 10:30:30','mm-dd-yy hh24:mi:ss') today,
to_date('02-22-08 10:30:30','mm-dd-yy hh24:mi:ss')+ 1/(24*60*60) next_sec
from dual;
TODAY NEXT_SEC
------------------------ ------------------------
02-22-08 10:30:30 02-22-08 10:30:31
select to_date('02-22-2008 10:30:30','mm-dd-yyyy hh24:mi:ss') today,
to_date('02-22-2008 10:30:30','mm-dd-yyyy hh24:mi:ss')+1 next_day
from dual;
TODAY NEXT_DAY
------------------------- -------------------------
02-22-08 10:30:30 02-23-08 10:30:30
Add an hour.
select to_date('02-22-08 10:30:30','mm-dd-yy hh24:mi:ss') today,
to_date('02-22-08 10:30:30','mm-dd-yy hh24:mi:ss')+ 1/24 next_hour
from dual;
TODAY NEXT_HOUR
------------------------ ------------------------
02-22-08 10:30:30 02-22-08 11:30:30
Add a minute.
select to_date('02-22-08 10:30:30','mm-dd-yy hh24:mi:ss') today,
to_date('02-22-08 10:30:30','mm-dd-yy hh24:mi:ss')+ 1/(24*60) next_min
from dual;
TODAY NEXT_MIN
------------------------ ------------------------
02-22-08 10:30:30 02-22-08 10:31:30
Add a second.
select to_date('02-22-08 10:30:30','mm-dd-yy hh24:mi:ss') today,
to_date('02-22-08 10:30:30','mm-dd-yy hh24:mi:ss')+ 1/(24*60*60) next_sec
from dual;
TODAY NEXT_SEC
------------------------ ------------------------
02-22-08 10:30:30 02-22-08 10:30:31
相关文章推荐
- How To Add Oracle JDBC Driver In Your Maven Local Repository
- How to add,edit and delete key-value in localStorage of Browse
- Maven_How To Add Oracle JDBC Driver In Your Maven Local Repository
- How to Delete From or Add Resource to OCR in Oracle Clusterware (文档 ID 1069369.1)
- How to add Oracle JDBC driver in your Maven local repository
- How to add Oracle JDBC driver in your Maven local repository
- Qt, how to add radio button or checkbox in menu
- How to start a second thread in an MFC-based ActiveX control to fire events in Visual C++
- How to access a value defined in the application.properties file in Spring Boot ( Externalized Conf)
- How to add extra harddriver, relocate /home in Ubuntu with VMWare player
- How to get primary key column in Oracle?
- How to Create a Second Level GridView in ASP.NET
- How to enable Apache, OC4J and OPMN logging in Oracle Applications R12
- How to Modify Public Network Information including VIP in Oracle Clusterware [ID 276434.1]
- How do I add an integer value with javascript (jquery) to a value that's returning a string?
- How to add a DELAY in applying transactions in GoldenGate?
- EM 12c : How to Manually add Database Target in Cloud Control 12c
- How to add the cracked dlls in GAC---let me tell u
- In Oracle 11g, how to change the order of the results of a sql without “order by”?(转)
- How to use udev for Oracle ASM in Oracle Linux 6 怎样使用udev在linux 6系统上使用asm