View Full Version : in:week number(1-52)+year/out:date of week's sunday
08-03-2004, 08:57 PM
anyone can help?
08-04-2004, 03:25 PM
do you just want to know what day(sun.-sat.) today is? do you want to know what is the date of the next (sun.-sat.) is? please clarify? ask specific questions and get specific answers.
08-04-2004, 03:56 PM
We are now at the 31 week of the year.
the output for 31 would be: 01/08/04 (which is the date of 31 week's sunday).
the output for week 34 (year 2004) would be: 15/08/04
the output for week 34 (year 2005) would be: 14/08/04
do you understand?
08-04-2004, 05:28 PM
ok, so you want to give the script the year and the week, and for the script to output the date for the sunday of that week in that year?
08-04-2004, 05:47 PM
08-06-2004, 02:50 PM
I am looking to do the same thing I am currently working on a solution, so if you come up with a solution before I please post. Thanks
08-06-2004, 05:26 PM
Full week starting with a Sunday or do you count the partial week that may be as little as one day?
08-06-2004, 06:27 PM
full week starting with sunday...
If you look at the calender, you can see that the year is divided into 52 weeks.
starting on the first sunday of Jan and ending at the 4th sunday of Dec.
I'd like to get the date of those sundays by entering the year and the week number...
I looked for some functions that has something to do with week number... but couldn't find any...
Did you hear of functions of this kind?
08-10-2004, 06:11 AM
function getSundayOfWeek(weekNum, year)
dim dNewYear, dFirstSunday
dNewYear = "1/1/" & year 'm/d/yyyy
dFirstSunday = weekday(dNewYear)
if dFirstSunday = 1 then 'sunday already
dFirstSunday = dNewYear
else 'not sunday so get next sunday
dFirstSunday = "1/" & (2 + (7 - dFirstSunday)) & "/" & year 'm/d/yyyy
getSundayOfWeek = dateadd("WW", weekNum-1, dFirstSunday) 'add weeks (subtract 1 to weeknum so that calculation is inclusive of the dFirstSunday
Take note that the function uses m/d/yyyy as the dateformat which is the settings in my Regional Options (Control Panel). Tweak the code to make it dd/mm/yyyy.
Powered by vBulletin® Version 4.2.2 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.