CAST语法:CAST ( expression AS data_type )
CONVERT语法:CONVERT (data_type[(length)], expression [, style])
style格式在转换时间时候的格式如下:
Style(2位表示年份) | Style(4位表示年份) | 输入输出格式
------------------------------------------------------------------------------------------------------------
0 | 100 | mon dd yyyy hh:miAM(或PM)
------------------------------------------------------------------------------------------------------------
1 | 101 美国 | mm/dd/yy
------------------------------------------------------------------------------------------------------------
2 | 102 ANSI | yy-mm-dd
------------------------------------------------------------------------------------------------------------
3 | 103 英法 | dd/mm/yy
------------------------------------------------------------------------------------------------------------
4 | 104 德国 | dd.mm.yy
------------------------------------------------------------------------------------------------------------
5 | 105 意大利 | dd-mm-yy
------------------------------------------------------------------------------------------------------------
6 | 106 | dd mon yy
------------------------------------------------------------------------------------------------------------
7 | 107 | mon dd,yy
------------------------------------------------------------------------------------------------------------
8 | 108 | hh:mm:ss
------------------------------------------------------------------------------------------------------------
9 | 109 | mon dd yyyy hh:mi:ss:mmmmAM(或PM)
------------------------------------------------------------------------------------------------------------
10 | 110 美国 | mm-dd-yy
------------------------------------------------------------------------------------------------------------
11 | 111 日本 | yy/mm/dd
------------------------------------------------------------------------------------------------------------
12 | 112 ISO | yymmdd
------------------------------------------------------------------------------------------------------------
13 | 113 欧洲默认值 | dd mon yyyy hh:mi:ss:mmm(24小时制)
------------------------------------------------------------------------------------------------------------
14 | 114 | hh:mi:ss:mmm(24小时制)
------------------------------------------------------------------------------------------------------------
20 | 120 ODBC 规范 | yyyy-mm-dd hh:mi:ss(24小时制)
------------------------------------------------------------------------------------------------------------
21 | 121 | yyyy-mm-dd hh:mi:ss:mmm(24小时制)