JUST DO IT ~

          我只想當(dāng)個(gè)程序員

          oracle trunc(sysdate ,'dd') 日期

          select trunc(sysdate ,'dd') from dual ;   --  2007-9-19

          select trunc(sysdate ,'yyyy') from dual ;   --2007-1-1

          select trunc(sysdate ,'mm') from dual ;   --2007-9-1



          begin
          dbms_output.put_line( to_char ( (sysdate)    , 'yyyy-mm-dd hh24:mi:ss'  ) ) ;
          dbms_output.put_line( to_char ( (sysdate)+ 1/24/60/10   , 'yyyy-mm-dd hh24:mi:ss'  ) ) ;
          dbms_output.put_line( to_char (  ((sysdate)+ 10 / ( 24*60*60 )   )  , 'yyyy-mm-dd hh24:mi:ss'  ) ) ;

          dbms_output.put_line( to_char (  trunc((sysdate)+ 10 / ( 24*60*60 )   )  , 'yyyy-mm-dd hh24:mi:ss'  ) ) ;

          end ;
          /

           

           


          begin
          dbms_output.put_line( '當(dāng)前時(shí)間 '  ) ;
          dbms_output.put_line( to_char ( (sysdate)    , 'yyyy-mm-dd hh24:mi:ss'  ) ) ;

          dbms_output.put_line( '當(dāng)前時(shí)間  + 1  s  '    ) ;
          dbms_output.put_line( to_char ( (sysdate)+ (((1/24)/60)/60   )   , 'yyyy-mm-dd hh24:mi:ss'  ) ) ;

          dbms_output.put_line( '當(dāng)前時(shí)間  + 1  s  '    ) ;
          dbms_output.put_line( to_char ( (sysdate)+ (((5/24)/60)/60   )   , 'yyyy-mm-dd hh24:mi:ss'  ) ) ;

          dbms_output.put_line( '當(dāng)前時(shí)間  + 10s  '   ) ;
          dbms_output.put_line( to_char (  ((sysdate)+  ( 10 / ( 24*60*60 ))    )  , 'yyyy-mm-dd hh24:mi:ss'  ) ) ;

          dbms_output.put_line( '當(dāng)前 日   '   ) ;
          dbms_output.put_line( to_char (  trunc((sysdate))  , 'yyyy-mm-dd hh24:mi:ss'  ) ) ;


          dbms_output.put_line( '當(dāng)前  第2天 1點(diǎn)  '   ) ;
          dbms_output.put_line( to_char (  trunc(sysdate)+(  1 +  1/24   ) , 'yyyy-mm-dd hh24:mi:ss'  ) ) ;


          dbms_output.put_line( '當(dāng)前  第2天 9點(diǎn)  '   ) ;
          dbms_output.put_line( to_char (  trunc(sysdate)+(  1 +  9/24   ) , 'yyyy-mm-dd hh24:mi:ss'  ) ) ;

           


          end ;
          /

           

           


          posted on 2007-09-19 20:17 小高 閱讀(20252) 評論(5)  編輯  收藏 所屬分類: Oracle

          評論

          # re: oracle trunc(sysdate ,'dd') 日期 2008-09-04 11:43 chh

          幫了大忙!!
          感謝  回復(fù)  更多評論   

          # re: oracle trunc(sysdate ,'dd') 日期 [未登錄] 2008-11-12 11:36 zhou

          非常感謝!  回復(fù)  更多評論   

          # re: oracle trunc(sysdate ,'dd') 日期 2008-11-19 17:37 gddg

          + 1分鐘

          select enttime_,
          to_date ( to_char( ((enttime_)+ 1 / ( 24*60 ) ) , 'yyyy-mm-dd hh24:mi:ss' ), 'yyyy-mm-dd hh24:mi:ss' )

          from dl_entrust   回復(fù)  更多評論   

          # re: oracle trunc(sysdate ,'dd') 日期 2011-07-14 09:58 ww

          總結(jié)的很好,受教了,多謝啊  回復(fù)  更多評論   

          # re: oracle trunc(sysdate ,'dd') 日期 2013-07-05 09:07 xtay573269555

          不錯(cuò)!!!  回復(fù)  更多評論   

          導(dǎo)航

          <2011年7月>
          262728293012
          3456789
          10111213141516
          17181920212223
          24252627282930
          31123456

          統(tǒng)計(jì)

          常用鏈接

          留言簿(3)

          隨筆分類(352)

          收藏夾(19)

          關(guān)注的blog

          手冊

          搜索

          積分與排名

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 浮梁县| 九江县| 沙田区| 盘山县| 阳城县| 田阳县| 金湖县| 松潘县| 山东省| 五指山市| 文安县| 玉林市| 黄冈市| 四会市| 白玉县| 西昌市| 武鸣县| 达孜县| 长寿区| 宾川县| 新田县| 凌海市| 彰化市| 达日县| 怀化市| 藁城市| 昆明市| 南丰县| 渭南市| 确山县| 富平县| 庐江县| 昌宁县| 安徽省| 双桥区| 剑川县| 油尖旺区| 余庆县| 汉沽区| 图们市| 莱西市|