Sql Server
函数-DateName
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 '秒'结果
| 当前日期 | 年 | 月 | 日 | 星期 | 周数 | 时 | 分 | 秒 | 
| 2023-06-30 15:30:53.867 | 2023 | 6 | 30 | 星期五 | 26 | 15 | 30 | 53 | 
