TEST===>Sqlserver中获取年月日时分秒

可以用两种方法获取

1.

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 '秒'

2.第二种

年:YEAR(GETDATE())

月:MONTH(GETDATE())

日:DAY(GETDATE())

上一篇:div的onclick事件怎么失效了?


下一篇:asp.net网页中添加年月日时分秒星期。