select 110,convert(varchar(10),getdate(),110)
select 111,convert(varchar(10),getdate(),111)
select 112,convert(varchar(10),getdate(),112)
select 113,convert(varchar(10),getdate(),113)
select 114,convert(varchar(10),getdate(),114)
select 120,convert(varchar(10),getdate(),120)
select 121,convert(varchar(10),getdate(),121)
返回结果
----------- ----------
110 07-20-2009
(1 row(s) affected)
----------- ----------
111 2009/07/20
(1 row(s) affected)
----------- ----------
112 20090720
(1 row(s) affected)
----------- ----------
113 20 Jul 200
(1 row(s) affected)
----------- ----------
114 14:32:20:9
(1 row(s) affected)
----------- ----------
120 2009-07-20
(1 row(s) affected)
----------- ----------
121 2009-07-20
(1 row(s) affected)

本文演示了如何使用SQL的convert函数将当前日期转换为不同的格式,包括短日期、长日期、年月日数字形式、简短月份年份形式及时间形式等。
6677

被折叠的 条评论
为什么被折叠?



