如何将从datepart得到的数字转换为日期名称? [英] How do you convert the number you get from datepart to the name of the day?

查看:200
本文介绍了如何将从datepart得到的数字转换为日期名称?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以快速调用Sql Server中的datepart并获取日期名称,而不仅仅是数字?

Is there a quick one-liner to call datepart in Sql Server and get back the name of the day instead of just the number?

select datepart(dw, getdate());

这将返回1-7,星期日为1。我想用星期日代替1 。

This will return 1-7, with Sunday being 1. I would like 'Sunday' instead of 1.

推荐答案

select datename(weekday, getdate());

这篇关于如何将从datepart得到的数字转换为日期名称?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆