ShMiL
08-03-2004, 08:57 PM
anyone can help?
|
||||
in:week number(1-52)+year/out:date of week's sundayShMiL 08-03-2004, 08:57 PM anyone can help? ecnarongi 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. ShMiL 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). another ex: 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? Thanks alot. ecnarongi 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? ShMiL 08-04-2004, 05:47 PM eXactly! ecnarongi 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 Roy Sinclair 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? ShMiL 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? Thanks glenngv 08-10-2004, 06:11 AM Try this: <% 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 end if getSundayOfWeek = dateadd("WW", weekNum-1, dFirstSunday) 'add weeks (subtract 1 to weeknum so that calculation is inclusive of the dFirstSunday end function response.write(getSundayOfWeek(52,2004)) '12/26/2004 response.write(getSundayOfWeek(31,2004)) '8/1/2004 %> 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. |
| |||
EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum