Is there some way to calculate the date for the monday (monday is first day
of w
where I live) of a given w
?I.e. given the w
number 36 the function should return September 5th,2005.
Regards.
SuneYou can use a calendar table, see http://www.aspfaq.com/2519
"Sune Hansen" <sdhXXX@.vertica.dk> wrote in message
news:%23w7PFR7sFHA.3236@.TK2MSFTNGP14.phx.gbl...
> Hi all,
> Is there some way to calculate the date for the monday (monday is first
> day of w
where I live) of a given w
?> I.e. given the w
number 36 the function should return September 5th,> 2005.
> Regards.
> Sune
>|||Build a calendar table of dates and w
numbers and then query thevalue from that.
SELECT w
_numFROM Calendar
WHERE cal_date = '20050905' ;
To calculate the w
number for the calendar, use the ISOWEEK functiongiven in the CREATE FUNCTION topic in Books Online (assuming you do in
fact want to use ISO w
numbers).David Portas
SQL Server MVP
--|||Do:
SELECT CURRENT_TIMESTAMP - @.@.DATEFIRST + 1
Anith|||Mistake:
SELECT DATEADD( d, @.wk * 7, DATEPART( wk, '20050101' ) -
( 7 - @.@.DATEFIRST ) ) - @.@.DATEFIRST + 1
-- where @.wk is your w
numberAnith
No comments:
Post a Comment