SQL命令中DateTime格式大全
格式字符参考表:
//说明:以下本来是一个表格,其列标题为:Format character Description Default return format
下面的为行显示
Format character
Description
Default return format
d
Short date pattern
MM/dd/yyyy
D
Long date pattern
dddd, MMMM dd, yyyy
f
Full (long date + short time)
dddd, MMMM dd, yyyy HH:mm
F
Full date time pattern (long date + long time)
dddd, MMMM dd, yyyy HH:mm:ss
g
General (short date + short time)
MM/dd/yyyy HH:mm
G
General (short date + long time)
MM/dd/yyyy HH:mm:ss
m,M
Month day pattern
MMMM dd
r,R
RFC1123 pattern
ddd, dd MMM yyyy HH':'mm':'ss'GMT'
s
Sortable date time pattern: conforms to ISO 8601
yyyy-MM-dd HH:mm:ss
t
Short time pattern
HH:mm
T
Long time pattern
HH:mm:ss
u
Similar to "s"but uses universal time instead of local time.
yyyy-MM-dd HH:mm:ss
U
Universal sortable date time pattern
dddd, MMMM dd, yyyy HH:mm:ss
Y,y
Year month pattern
MMMM, yyyy