T-sql 获取年,月,日,时,分,秒

select year('2013-05-16 23:22:15')
select month('2013-05-16 23:22:15')
select day('2013-05-16 23:22:15')
select datepart(hour,'2013-05-16 23:22:15')
select datepart(minute,'2013-05-16 23:22:15')
select datepart(second,'2013-05-16 23:22:15')

 

你可能感兴趣的:(t-sql)