sql 获取年月日星期周数时分秒

?select GETDATE() as '当前日期',
DateName(year,GetDate()) as '年',
DateName(month,GetDate()) as '月',
DateName(day,GetDate()) as '日',
DateName(dw,GetDate()) as '星期',
DateName(week,GetDate()) as '周数',
DateName(hour,GetDate()) as '时',
DateName(minute,GetDate()) as '分',
DateName(second,GetDate()) as '秒'

结果:

2009-08-13 23:07:15.403 2009 08 13 星期四 33 23 7 15

你可能感兴趣的:(sql)