昨天用到了一些日期函数,简单记录如下:
SELECT DATEPART(month, '2007-02-14')
返回 10 (等同于month('2007-02-14'))
select datepart(weekday,getdate())
返回1-7 1为星期天
select datename(weekday,getdate())
返回 星期(-到日)
select datediff(day,'2007-02-10',getdate())
返回 4
select getdate()
输出:2007-02-14 10:24:51.450
select convert(varchar(10),getdate(),120)
输出:2007-02-14
以下记录些与日期相关的函数
伊图教程网[www.etoow.com]
http://www.etoow.com/html/2007-08/1186929277.html
GetDate( ) 返回系统目前的日期与时间
日期函数
'http://www.etoow.com/html/2007-08/1186929277.html