追求編程之美

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

          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) 評(píng)論(0)  編輯  收藏


          只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。


          網(wǎng)站導(dǎo)航:
           
          主站蜘蛛池模板: 湄潭县| 桃园县| 连云港市| 新巴尔虎右旗| 旅游| 广宁县| 双城市| 军事| 达州市| 拜城县| 天津市| 铜鼓县| 谷城县| 乌拉特后旗| 府谷县| 克什克腾旗| 海阳市| 福安市| 太原市| 沽源县| 曲周县| 噶尔县| 罗山县| 手机| 廉江市| 安丘市| 康马县| 青州市| 峨边| 湘阴县| 三河市| 平果县| 秦皇岛市| 襄城县| 平乡县| 调兵山市| 宜川县| 女性| 馆陶县| 鄂尔多斯市| 江门市|