码迷,mamicode.com
首页 > 数据库 > 详细

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

时间:2018-05-31 11:26:56      阅读:196      评论:0      收藏:0      [点我收藏+]

标签:mon   sql   get   day   server   TE   name   date()   second   

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获取当前日期的年、月、日、时、分、秒数据

标签:mon   sql   get   day   server   TE   name   date()   second   

原文地址:https://www.cnblogs.com/huyueping/p/9115453.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!