DB2 格式化输出 Date
生活随笔
收集整理的這篇文章主要介紹了
DB2 格式化输出 Date
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
轉自:http://www.cnblogs.com/zjun/archive/2012/02/15/2353054.html
在Oracle中可以使用TO_CHAR()函數來將日期類型的數據轉換成字符串輸出,并且可以指定輸出格式: TO_CHAR(date_expression, 'YYYY-MM-DD')?TO_CHAR(date_expression, 'HH24:MI:SS') DB2也有TO_CHAR 和 TO_DATE函數,但只能提供固定的轉換格式,而且數據類型是timestamp,如下: TO_CHAR (timestamp_expression,'YYY-MM-DD HH24:MI:SS')
TO_DATE (string_expression, 'YYY-MM-DD HH24:MI:SS') 如果要轉換date的格式,直接用CHAR()函數,如下: CHAR(date_expression,ISO)
CHAR(time_expression,ISO) ISO指定的日期格式是 yyyy-MM-dd,可以指定其他的格式:
| 參數 | 日期格式 | 說明 |
| DEF | ? | Use a date and time format associated with the territory code. |
| EUR | 30.01-2011 | Use the IBM standard for Europe date and time format. |
| ISO | 2011-01-30 | Use the date and time format of the International Standards Organization. |
| JIS | 2011-01-30 | Use the date and time format of the Japanese Industrial Standard. |
| LOC | ? | Use the date and time format in local form associated with the territory code of the database. |
| USA | 01/30/2011 | Use the IBM standard for U.S. date and time format. |
總結
以上是生活随笔為你收集整理的DB2 格式化输出 Date的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 既然选择了远方 便只顾风雨兼程
- 下一篇: rbac 相关