zoukankan      html  css  js  c++  java
  • Oracle trunc() 函数

    select trunc(sysdate) from dual  --2013/2/20  今天的日期为2013/2/20
    select trunc(sysdate, 'mm')   from   dual  --2013/2/1    返回当月第一天.
    select trunc(sysdate,'yy') from dual  --2013/1/1       返回当年第一天
    select trunc(sysdate,'dd') from dual  --2013/2/20    返回当前年月日
    select trunc(sysdate,'yyyy') from dual  --2013/1/1   返回当年第一天
    select trunc(sysdate,'d') from dual  --2013/2/17 (星期天)返回当前星期的第一天
    select trunc(sysdate, 'hh') from dual   --2013/2/20 10:00:00   当前时间为10:00:00  
    select trunc(sysdate, 'mi') from dual  --2013/2/20 10:24:00   TRUNC()函数没有秒的精确

    select trunc(123.458) from dual --123
    select trunc(123.458,0) from dual --123
    select trunc(123.458,1) from dual --123.4
    select trunc(123.458,-1) from dual --120
    select trunc(123.458,-4) from dual --0
    select trunc(123.458,4) from dual  --123.458
    select trunc(123) from dual  --123
    select trunc(123,1) from dual --123
    select trunc(123,-1) from dual --120

  • 相关阅读:
    poj 3318 Matrix Multiplication 夜
    hdu 4331 Image Recognition 夜
    poj 3277 City Horizon 夜
    poj 3301 Texas Trip 夜
    poj 1151 Atlantis 夜
    poj 3286 How many 0's 夜
    poj 2454 Jersey Politics 夜
    poj 1465 Multiple 夜
    poj 1095 Trees Made to Order 夜
    Null和undefined的区别?
  • 原文地址:https://www.cnblogs.com/jenliy/p/2918182.html
Copyright © 2011-2022 走看看