追求編程之美

          先做人,再做技術人員,最后做程序員。
          數據加載中……
          date_trunc函數的用法

          9.9.2. date_trunc

          The function date_trunc is conceptually similar to the trunc function for numbers.

           

          date_trunc('field', source)

          source is a value expression of type timestamp or interval. (Values of type date and time are cast automatically, to timestamp or interval respectively.) field selects to which precision to truncate the input value. The return value is of type timestamp or interval with all fields that are less significant than the selected one set to zero (or one, for day and month).

          Valid values for field are:

           

          microseconds
          milliseconds
          second
          minute
          hour
          day
          week
          month
          quarter
          year
          decade
          century
          millennium

           

           

          Examples:

          SELECT date_trunc('hour', TIMESTAMP '2001-02-16 20:38:40');
          Result: 2001-02-16 20:00:00
          SELECT date_trunc('year', TIMESTAMP '2001-02-16 20:38:40');
          Result: 2001-01-01 00:00:00

           

          posted on 2009-07-24 07:02 yanZhangWu 閱讀(12957) 評論(0)  編輯  收藏


          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          主站蜘蛛池模板: 耿马| 十堰市| 金塔县| 辰溪县| 青神县| 济宁市| 阿拉善右旗| 马鞍山市| 江津市| 渭南市| 大同市| 平南县| 大方县| 昭觉县| 贺州市| 襄樊市| 东阳市| 昔阳县| 阳泉市| 施甸县| 梓潼县| 连江县| 德令哈市| 南丹县| 吴川市| 奈曼旗| 桐梓县| 枞阳县| 景泰县| 秭归县| 清徐县| 佛坪县| 金川县| 锦州市| 神木县| 凤山市| 海门市| 宁明县| 儋州市| 云南省| 永年县|