首页 > 代码库 > SQL 数据库 日期函数GETDATE

SQL 数据库 日期函数GETDATE

Without century (yy) (1)

With century (yyyy)                      

Standard                      

Input/Output (3)                      

-                      

0 or 100 (1, 2)                       

Default                      

mon dd yyyy hh:miAM (or PM)                      

1                                               

101                                               

U.S.                      

1 = mm/dd/yy                      

101 = mm/dd/yyyy                      

2                                               

102                                               

ANSI                      

2 = yy.mm.dd                      

102 = yyyy.mm.dd                      

3                                               

103                                               

British/French                      

3 = dd/mm/yy                      

103 = dd/mm/yyyy                      

4                                               

104                                               

German                      

4 = dd.mm.yy                      

104 = dd.mm.yyyy                      

5                                               

105                                               

Italian                      

5 = dd-mm-yy                      

105 = dd-mm-yyyy                      

6                                               

106 (1)                      

-                      

6 = dd mon yy                      

106 = dd mon yyyy                      

7                                               

107 (1)                      

-                      

7 = Mon dd, yy                      

107 = Mon dd, yyyy                      

8                                               

108                                               

-                      

hh:mi:ss                      

-                      

9 or 109 (1, 2)                       

Default + milliseconds                      

mon dd yyyy hh:mi:ss:mmmAM (or PM)                      

10                                               

110                                               

USA                      

10 = mm-dd-yy                      

110 = mm-dd-yyyy                      

11                                               

111                                               

JAPAN                      

11 = yy/mm/dd                      

111 = yyyy/mm/dd                      

12                                               

112                                               

ISO                      

12 = yymmdd                      

112 = yyyymmdd                      

-                      

13 or 113 (1, 2)                       

Europe default + milliseconds                      

dd mon yyyy hh:mi:ss:mmm(24h)                      

14                                               

114                                               

-                      

hh:mi:ss:mmm(24h)                      

-                      

20 or 120 (2)                       

ODBC canonical                      

yyyy-mm-dd hh:mi:ss(24h)                      

-                      

21 or 121 (2)                       

ODBC canonical (with milliseconds)                      

yyyy-mm-dd hh:mi:ss.mmm(24h)                      

-                      

126 (4)                      

ISO8601                      

yyyy-mm-ddThh:mi:ss.mmm (no spaces)                      

Note                               Note                            

When the value for milliseconds (mmm) is 0, the millisecond value is not displayed. For example, the value ‘2012-11-07T18:26:20.000 is displayed as ‘2012-11-07T18:26:20‘.

-                      

127(6, 7)                      

ISO8601 with time zone Z.                      

yyyy-mm-ddThh:mi:ss.mmmZ (no spaces)                      

Note                               Note                            

When the value for milliseconds (mmm) is 0, the milliseconds value is not displayed. For example, the value ‘2012-11-07T18:26:20.000 is displayed as ‘2012-11-07T18:26:20‘.

-                      

130 (1, 2)                      

Hijri (5)                      

dd mon yyyy hh:mi:ss:mmmAM                      

In this style, mon represents a multi-token Hijri unicode representation of the full month‘s name. This value will not render correctly on a default US installation of SSMS.

-                      

131 (2)                      

Hijri (5)                      

dd/mm/yyyy hh:mi:ss:mmmAM

SQL 数据库 日期函数GETDATE