Date calculation

  • Follow


Hi there,I'm trying to build a function that can calculate, for a period until5 months, the specified date.For example, if i select today's date, 2nd October, the function mustreturn the following dates:November 6December 4January 1february 5I've check and in some month the date, is days, distance is 28 but inothers it is 35. What happens for this number variation? I've analyzedthe number of weeks in a month, the start and end weekday of the monthand the number of days in the month but i can't seem to discover whathappens to be 35 or 28.Any help will be usefull.Thanks in advance.Regards
0
Reply kubic62 (34) 10/2/2007 5:12:46 PM

On Oct 2, 7:12 pm, Pedro Pinto <kubi...@gmail.com> wrote:> 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 (onepeople hang up at the wall), you would have recognized that the dateis in some way "rounded" to the same day of week. The dates are allTuesdays. I'll leave it up to you to figure out if the "rounding" isup, down, nearest or whatever, and if the calculation is always donefrom the start date, or each next calculated date serves as a freshstarting point. It's your homework, not ours.
0
Reply Hunter 10/2/2007 5:55:24 PM


On Tue, 02 Oct 2007 10:12:46 -0700, Pedro Pinto <kubic62@gmail.com>wrote, quoted or indirectly quoted someone who said :>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 5this is the sort of thing BigDate does in its sleep.  It is bundledpart of http://mindprod.com/products1.html#COMMON11Look at the TestDate method which shows dozens of applications.-- Roedy Green Canadian Mind ProductsThe Java Glossaryhttp://mindprod.com
0
Reply Roedy 10/3/2007 12:56:30 AM

In comp.lang.java.programmer message <1191345166.023670.315510@o80g2000hse.googlegroups.com>, Tue, 2 Oct 2007 10:12:46, Pedro Pinto<kubic62@gmail.com> posted:>>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)thday 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.--  (c) John Stockton, Surrey, UK.  ?@merlyn.demon.co.uk   Turnpike v6.05   IE 6. 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.
0
Reply Dr 10/3/2007 12:45:54 PM

3 Replies
108 Views

(page loaded in 0.079 seconds)

Similiar Articles:













7/30/2012 12:05:47 PM


Reply: