Re: DT_DATE_TIME_DURATION usage
Eric Bezault <ericb-D6Qt/9opevxWk0Htik3J/[email protected]> Thu, 29 May 2008 00:13:21 +0200
| Newsgroups | gmane.comp.lang.eiffel.gobo.general |
|---|---|
| Message-ID | <[email protected]> |
Berend de Boer wrote: >>>>>> "Eric" == Eric Bezault <ericb-D6Qt/9opevxWk0Htik3J/[email protected]> writes: > > Eric> In that case I would suggest turning the duration into a > Eric> definite duration (using `to_definite'). > > This step isn't clear when I tried it. to_definite takes a DT_DATE_TIME > parameter, but why? According to the docs it shouldn't. Quoting from > duration.html: > > Note that the first two routines need a date/time as argument which is > used as origin in order to make the duration deterministic before the > conversion. Well, according to the doc it should take a DT_DATE_TIME as argument! The reason why it takes a DT_DATE_TIME was what I referred to in my initial message when I said: ~~~~~~~~~~~~~~~~~~~ Let's consider that you have a duration of 1 month, and you want to quarter of it. What should it be? Well, I guess it depends on what you want to do with that duration. If it's to be added to a date, then the result depends on that date. In that case I would suggest turning the duration into a definite duration (using `to_definite'). ~~~~~~~~~~~~~~~~~~~ Indeed, one month to be added to 1 Feb 2007 is equivalent to 28 days. So a quarter of it will be 7 days. But when to be added to 1 Jan 2007 it is equivalent to 31 days. And a quarter of it will be 7 days and 18 hours. -- Eric Bezault mailto:ericb-D6Qt/9opevxWk0Htik3J/[email protected] http://www.gobosoft.com