Re: First Monday after today?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



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.
.



Relevant Pages

  • Re: Calculation bug or is it me
    ... Yes I was missing the obvious Ron, as Mister T and Bernie and Loz had also ... pointed out...thanks for the response. ... Tom ... I get expected results from the calculation. ...
    (microsoft.public.excel.programming)
  • Calculation bug or is it me
    ... what am I missing here. ... Using XL2K3 XP, no problems with my computer, trying to divide a series of ... numbers by 100, then multiplying that quotient by 100, and getting illogical ... The problem is I need to do this calculation programmatically and the result ...
    (microsoft.public.excel.programming)
  • Re: [Bug #13319] Page allocation failures with b43 and p54usb
    ... moves the mask to kmem_cache_openand calls calculate_sizestwice. ... My prosal was to use the size and objsize parameters. ... calculation from calculate_sizessomehow. ...
    (Linux-Kernel)
  • Re: [PHP] Checking file existence
    ... I assume your aware that the filenames are not very unique (i.e. twice a ... What's the best way to take the current hhmm timestamp and run ... Notice the gaps, 1120, 1118, and 1115 are missing. ...
    (php.general)
  • Re: Calculate Monthly Aggregated Data
    ... I'd suggest (but beware I am not an expert at all in Access: ... trying to use common sense) that you add a missing piece of information ... (the dates where you want to do the calculation). ...
    (comp.databases.ms-access)