select convert(varchar,getdate(),120)--2010-08-20 23:10:15
select convert(varchar(10), getdate(),120)--2010-08-20
select replace(replace(replace(convert(varchar, getdate(),120),'-',''),' ',''),':','')--20100820231015
select convert(varchar(12),getdate(),111) --2010/08/20
select convert(varchar(12),getdate(),112) --20100820
select convert(varchar(12),getdate(),108) --23:10:15
SQL利用Convert函数获得指定格式的日期字符串
SQL日期格式转换技巧
最新推荐文章于 2023-05-09 18:21:16 发布
本文介绍了使用SQL进行日期格式转换的方法,包括不同格式的日期输出,如年月日时分秒、仅年月日等,并展示了如何去除日期中的特殊字符。
1万+

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



