1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
| select GETDATE() as '当前日期时间', DateName(year,GetDate())+'-'+DateName(month,GetDate())+'-'+DateName(day,GetDate()) as '当前日期', DateName(quarter,GetDate()) as '第几季度', DateName(week,GetDate()) as '一年中的第几周', DateName(DAYOFYEAR,GetDate()) as '一年中的第几天', DateName(year,GetDate()) as '年', DateName(month,GetDate()) as '月', DateName(day,GetDate()) as '日', DateName(hour,GetDate()) as '时', DateName(minute,GetDate()) as '分', DateName(second,GetDate()) as '秒', DateName(MILLISECOND,GetDate()) as '豪秒', DateName(WEEKDAY,GetDate()) as '星期几'
select GETDATE() as '当前日期时间', DatePart(year,GetDate())+'-'+DatePart(month,GetDate())+'-'+DatePart(day,GetDate()) as '当前日期', DatePart(quarter,GetDate()) as '第几季度', DatePart(week,GetDate()) as '一年中的第几周', DatePart(DAYOFYEAR,GetDate()) as '一年中的第几天', DatePart(year,GetDate()) as '年', DatePart(month,GetDate()) as '月', DatePart(day,GetDate()) as '日', DatePart(hour,GetDate()) as '时', DatePart(minute,GetDate()) as '分', DatePart(second,GetDate()) as '秒', DatePart(MILLISECOND,GetDate()) as '豪秒', DatePart(WEEKDAY,GetDate()) as '星期几'
|