Re: First Monday after today?
- From: Dr John Stockton <jrs@xxxxxxxxxxxxxxxxxx>
- Date: Sat, 12 Nov 2005 21:35:47 +0000
JRS: In article <uEyiZZt5FHA.2524@xxxxxxxxxxxxxxxxxxxx>, dated Sat, 12
Nov 2005 00:41:10, seen in news:microsoft.public.scripting.vbscript, Han
<hp4444@xxxxxxxxxxxxxxxx> posted :
>Thanks Christoph,
>
>Inspired by your idea, I discovered what I was missing.
>
>d1 = dateadd("d", (7-(weekday(date)-2)), date)
Date should not be called twice in a calculation; it is time-consuming,
and may change. Your code appears to give me the 21st if called
tomorrow.
D = Date : D = D + 7 - (D+5) mod 7
document.write D
The answer must be 1..7 days ahead, and does not generally change at
midnight, so add 7 and subtract something like D mod 7; but adjust that
to get the right result, hence +5.
IIRC, <URL:http://www.merlyn.demon.co.uk/vb-dates.htm> does not yet have
just that. But <URL:http://www.merlyn.demon.co.uk/js-date7.htm#NPXD>
indicates the method.
--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 MIME. ©
Web <URL:http://www.merlyn.demon.co.uk/> - w. FAQish topics, links, acronyms
PAS EXE etc : <URL:http://www.merlyn.demon.co.uk/programs/> - see 00index.htm
Dates - miscdate.htm moredate.htm js-dates.htm pas-time.htm critdate.htm etc.
.
- References:
- First Monday after today?
- From: Han
- Re: First Monday after today?
- From: Han
- First Monday after today?
- Prev by Date: Re: .vbs file, lookup IP and verify it with location, send a message box with loc.
- Next by Date: Thanks Is there a way...
- Previous by thread: Re: First Monday after today?
- Next by thread: Regulating audio volume from script
- Index(es):
Relevant Pages
|