zoukankan      html  css  js  c++  java
  • How To Add Day, Hour, Minute, Second to a Date Value in Oracle

      1. 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
      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
  • 相关阅读:
    约瑟夫环问题
    String常用的工具类
    java 中的==和equals的深度解析
    Intellij IDEA的一些常用设置和使用小技巧
    jvm内存模型概述
    springcloud开篇
    oracle生成path的sql语句
    oracle表空间异常大
    springboot2集成activiti出错
    策略模式2
  • 原文地址:https://www.cnblogs.com/QDuck/p/2482372.html
Copyright © 2011-2022 走看看