Anonymous 发表于 2021-10-6 00:00:39

oracle 在原有的时间上加一天,加一个小时,加一分钟

oracle 在原有的时间上加一天,加一个小时,加一分钟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;
TODAYNEXT_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;
TODAYNEXT_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;
TODAYNEXT_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;
TODAYNEXT_SEC
------------------------ ------------------------
02-22-08 10:30:30 02-22-08 10:30:31
————————————————

原文链接:https://blog.csdn.net/T123012009065/article/details/8243152


页: [1]
查看完整版本: oracle 在原有的时间上加一天,加一个小时,加一分钟