日期函数

来源:互联网 发布:淘宝客增加权重吗 编辑:程序博客网 时间:2024/05/21 17:31

时间表示方法
以下示例显示用 style 参数进行转换:

Select CONVERT(char(12), GETDATE(), 3)

此语句把当前日期转换为样式 3,dd/mm/yy。
在这里我附上一些实例:

select CONVERT(varchar, getdate(), 120 )
2004-09-12 11:06:08

select replace(replace(replace(CONVERT(varchar, getdate(), 120 ),'-',''),' ',''),':','')
20040912110608

select CONVERT(varchar(12) , getdate(), 111 )
2004/09/12

select CONVERT(varchar(12) , getdate(), 112 )
20040912


原创粉丝点击