SQL获取当前日期的年月日时分秒数据

Posted 追你追到

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了SQL获取当前日期的年月日时分秒数据相关的知识,希望对你有一定的参考价值。

SQL Server中获取当前日期的年、月、日、时、分、秒数据:

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









以上是关于SQL获取当前日期的年月日时分秒数据的主要内容,如果未能解决你的问题,请参考以下文章