sql 查询给定日期是星期几
Jun 07, 2016 pm 05:47 PMsql 查询给定日期是星期几
sql 查询给定日期是星期几
declare @date datetime
set @date= getdate()
--datepart(weekday,date)的返回值与@@datefirst相关
set datefirst 7 -- 或者设置为美国英语set language us_english; (星期日为第一天)
select datepart(weekday,@date) --返回值 1-星期日,2-星期一,3-星期二......7-星期六
--上面算法与sql 语言版本或 @@datefirst 相关
--下面算法与sql server语言版本或@@datefirst无关
select datename(weekday,@date) '星期'
go

Hot Article

Hot tools Tags

Hot Article

Hot Article Tags

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

How to search previous Weibo by date on Weibo_How to search previous Weibo by date on Weibo

What is the difference between HQL and SQL in Hibernate framework?

Usage of division operation in Oracle SQL

Comparison and differences of SQL syntax between Oracle and DB2

How to check your academic qualifications on Xuexin.com

12306 How to check historical ticket purchase records How to check historical ticket purchase records

How to remove the date that appears automatically when printing from PPT handouts

How to check the activation date on Apple mobile phone
