例子select datename(weekday,getdate())
select datepart(weekday,getdate())--返回的是时间类型
日期部分 | 缩写 |
---|---|
year | yy, yyyy |
quarter | qq, q |
month | mm, m |
dayofyear | dy, y |
day | dd, d |
week | wk, ww |
weekday | dw |
Hour | hh |
minute | mi, n |
second | ss, s |
millisecond | ms |