Getting week number of date in SQL

前端 未结 6 1389
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-23 08:26

Is there a way to get the week number of a date with SQL that is database independent?

For example to get the month of a date I use:

SELECT EXTRACT(MONTH         


        
6条回答
  •  星月不相逢
    2021-01-23 08:57

    You can try this.

    declare @date datetime select @date='2013-03-15 00:00:00' select 'Week No: '+ convert(varchar(10),datepart(wk,@date)) as weekno

提交回复
热议问题