Re: Possible bug in Calendar



"Harold Yarmouth" wrote:
That is not a "case in point". Locale-specific rules may be involved in providing the localized user interfaces, including selection of which business rules to apply, but in the core logic classes I *hope* your Dates are all represented in one particular time base and that when the chosen business rules say "x is three days after y" it just adds 3*86400*1000ms to some number somewhere under the hood.

That misconceived calculation, in fact, was the source of the bugs I'm fixing - people erroneously calculated intervals of days by multiplying 24 hours times the number of milliseconds in an hour. Of course, not every calendar day is 24 hours long, at least not in the U.S., Canada, the U.K. and a host of other countries, so a couple of times a year this would return the wrong interval.

"Harold"'s proposed interval calculation is wrong. The advantage of Calendar, in this case GregorianCalendar, for all its flaws, is that it correctly calculates intervals like "three days after y", rather than by such a naive and incorrect means.

Arne Vajhøj wrote:
Nonsense.

People pay bills the 1st every month not at X milliseconds interval.

Or the 15th, or every two weeks, or whatever. Calendar is able to give a reasonable interpretation to "one month after January 31, 2008", not to be confused with "30 days after January 31, 2008".

Some years back I worked on a warehouse project where the client billed their customers according to the number of days their goods were in storage, but also gave special deals as incentives. The deals were things like, "first three days free, not including weekends or holidays".

Calendars are messy, human, psychological phenomena, not pristine mathematical concepts.

--
Lew
.



Relevant Pages

  • Re: How do I setup Fiscal Yr to begin in October in Access
    ... I have the quarter column set up for the beginning assessment date ... If your fiscal months always begin on the first of the calendar months, ... then the solutions suggested by the other responders will work fine. ... company's actual business rules. ...
    (microsoft.public.access.queries)
  • Re: Relative time in SQL
    ... "Tom Ogilvy" wrote ... ... I had my suspicions. ... but additionally refers to their calendar table (their business rules ...
    (microsoft.public.excel.programming)
  • Re: Date query
    ... Just ignore this guy - the number of times he's been told the yyyy-mm-dd format is problematic and doesn't work across national boundaries is countless. ... holds your temporal data and business rules. ... the last calendar date of each month or the last business date of each ...
    (microsoft.public.sqlserver.programming)
  • Re: Extended-Range Time Type
    ... same calendric system can be calculated exactly, i.e., as if they ... business rules, at least from the ISO C library. ... open source libraries to provide calendar types for the most ...
    (comp.std.c)