Dr
Wed Mar 15 07:09:34 CST 2006
JRS: In article <H_-dnU8BherQe4vZRVn-pw@comcast.com>, dated Tue, 14 Mar
2006 09:50:38 remote, seen in news:microsoft.public.scripting.vbscript,
McKirahan <News@McKirahan.com> posted :
>"Apricot" <yilu@21cn.com> wrote in message
>news:akmd12p7vo63br2s6qc91vpct4sekq3tfg@4ax.com...
>> I have a scheduled task, should be run at every day, or every
>> first day of next week, or every first day of next month (from now).
>> I'm wondering if it's possible that:
>> Given today = March 13, 2006
>> Then URoundWeek(today) == March 20, 2006
>> URoundMonth(today) == April 1, 2006
>Anyway, you'll have to define your rounding rules:
Scheduling is used for future events; it does not apply to past ones.
>1) round to next day
>
>Round up if "12:01 PM"?
The OP is evidently not in the USA : out of politeness, you should not
use strange notations such as the 12-hour clock. 24-hour times are much
easier for others to follow, and can be understood by most Americans
too.
The next day is given by
D = Date
ND = D + 1
>2) round to next week
>
>Round up if Wednesday?
>(based on Sunday being the first day of the week?)
Why use that basis? The International Standard has weeks Monday to
Sunday. The OP is posting from 8 hours ahead of GMT, and has an address
at 21cn.com, and indicates that March 20, 2006 is the current answer.
That will be a Monday. It's unreasonable to treat him or her as wanting
to do things as they might be done in the USA.
The OP's English is good ; "next week" does not mean "nearest start-of-
week".
>3) round to next month
>
>Does it depend on the number of days in the month? For example,
> 02/14/2006 rounds up to 03/01/2006
> 03/16/2006 rounds up to 04/01/2006
>Does 03/15/2006 round down to 03/01/2006?
This is an internationally-used newsgroup, so it is bad manners to write
dates in FFF notation. If you cannot bring yourself to use YYYY-MM-DD,
at least follow the OP's lead and put months in words.
Next month has a clear meaning; if the OP had wanted "nearest 1st",
he/she should not have put "next month".
NM = DateSerial(Year(D), Month(D)+1, 1)
Have you considered taking an EFL course?
--
© 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.