Re: prefixes and namespaces?

new topic     » goto parent     » topic index » view thread      » older message » newer message

Jeremy Cowgar wrote:
> 
> Julio C. Galaret Viera wrote:
> > 
> > In my opinion it is not a good idea to prefix those functions.
> 
> Ok, noted as a vote no prefix.
>  
> > Neither is good to have so many functions like ...add_days, ..add_minutes,
> > weeks,
> > months and so on.
> > 
> > It would be enough to have an ADD function where you set the interval (year,
> > month, week, day...):
> > For example,
> > - add 30 days: ..._ADD(DAY, 30, mydate or mydatetime)
> > - add 1 week:  ..._ADD(WEEK, 1, mydate or mydatetime)
> 
> There are two methods for adding/subtracting. you saw them both add_seconds
> and add_days. They can be used to subtract by doing add_days(-10....).
> 
> The reason there are those two is due to simplicity. Adding seconds allows you
> to easily manipulate time. For instance, 3600*5 would add 5 hours. Adding days
> allows you to easily manipulate a day.
> 
> As for adding weeks, months, etc... That gets very difficult because what is
> a month, for instance? The average is 4.3 weeks, but that's an average. I
> think
> in most programs you don't wind up adding in intervals of weeks, months,
> etc...
> It's possible. But you could use, if you wish, add_days(7*4.3...) and add
> months,
> weeks, or whatever you wanted.
> 
> So, we did try to make things as minimal as possible by adding just two
> functions,
> add days and add seconds, as to work well with manipulating times and dates.

On this subject I can speak.  I work with addition and determination of dates
and ages frequently.  And it is all a crapshoot.  If you have access to Excel,
take a look at the types of dates they perceive can underly these determinations.
 Bankers rules are commonly used.  Completed periods are sometimes used. 
Rounding is sometimes used.  Rounding itself can be based on the interval in
question or a theoretical one.  That is, for some purposes, months are considered
to always have 30 days (daily compounding of interest between a certain number of
months, leading to the rule of 360).

In other words, I concur that having an add_months function is quite involved
(although certainly not impossible) and would require at least one additional
parameter to deal with the inconsistencies created by the months of our calendar
having different numbers of days.

Mike

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu