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

来源:互联网 发布:怎么跟淘宝达人合作 编辑:程序博客网 时间:2024/04/20 07:37
  1. 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
  2. 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
  3. 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
  4. 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
原创粉丝点击