Date calculation

P

Pedro Pinto

Hi there,

I'm trying to build a function that can calculate, for a period until
5 months, the specified date.
For example, if i select today's date, 2nd October, the function must
return the following dates:

November 6
December 4
January 1
february 5

I've check and in some month the date, is days, distance is 28 but in
others it is 35. What happens for this number variation? I've analyzed
the number of weeks in a month, the start and end weekday of the month
and the number of days in the month but i can't seem to discover what
happens to be 35 or 28.

Any help will be usefull.

Thanks in advance.

Regards
 
H

Hunter Gratzner

I'm trying to build a function that can calculate, for a period until
5 months, the specified date.
For example, if i select today's date, 2nd October, the function must
return the following dates:

November 6
December 4
January 1
february 5

I've check and in some month the date, is days, distance is 28 but in
others it is 35. What happens for this number variation? I've analyzed
the number of weeks in a month, the start and end weekday of the month
and the number of days in the month but i can't seem to discover what
happens to be 35 or 28.

Would you have spent five seconds and looked at a real calendar (one
people hang up at the wall), you would have recognized that the date
is in some way "rounded" to the same day of week. The dates are all
Tuesdays. I'll leave it up to you to figure out if the "rounding" is
up, down, nearest or whatever, and if the calculation is always done
from the start date, or each next calculated date serves as a fresh
starting point. It's your homework, not ours.
 
R

Roedy Green

I'm trying to build a function that can calculate, for a period until
5 months, the specified date.
For example, if i select today's date, 2nd October, the function must
return the following dates:

November 6
December 4
January 1
february 5

this is the sort of thing BigDate does in its sleep. It is bundled
part of http://mindprod.com/products1.html#COMMON11

Look at the TestDate method which shows dozens of applications.
 
D

Dr J R Stockton

In comp.lang.java.programmer message <1191345166.023670.315510@o80g2000h
se.googlegroups.com>, Tue, 2 Oct 2007 10:12:46, Pedro Pinto
I'm trying to build a function that can calculate, for a period until
5 months, the specified date.

The N'th X-day of the month is always the nearest X-day to the (7*N-3)th
day of the month.

The N'th X-day of the month always lies in the inclusive range from the
(7*N-6)th to the (7*N)th of the month.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,280
Latest member
BGBBrock56

Latest Threads

Top