PDA

View Full Version : asp Jscript week of the month


moiseszaragoza
10-08-2010, 01:32 PM
I was wondering if there was a asp JScript function that will tell me what week of the month it today is. I mean F Oct 8 2010 = 2 week of the month and S Oct 10 2010 = 3rd week of the month Thanks
I was wondering if there was a asp JScript function that will tell me what week of the month it today is.



I mean F Oct 8 2010 = 2 week of the month and S Oct 10 2010 = 3rd week of the month



Thanks

Old Pedant
10-08-2010, 07:42 PM
JScript has *VERY VERY* few functions to help with dates and times. After all, JScript really is JavaScript, and JavaScript is weak in this area.

Having said that, I'm not sure there are even any functions in VBScript that would help you here.

What I might do:
-- find what day of the week the 1st of the month is on (JS can tell you that)
-- move forward to the last day (Saturday, or Sunday, depending on what you use in your country) of that same week
-- set the weeknumber to 1
-- ($$) see if the DAY of that last-day-of-the-week is >= your input day; if so, you are done...use weeknumber
-- if not, add 7 days to the last-day-of-the-week to get to end of next week.
-- add 1 to the weeknumber
-- loop back to ($$)