Subject | Re: [firebird-support] Date Arithmatic |
---|---|
Author | Helen Borrie |
Post date | 2004-11-18T13:31:44Z |
At 02:35 PM 18/11/2004 +0200, you wrote:
days. To store it like you want, you would first have to calculate that
number into hours and minutes, discarding the rest; do some parsing to
convert these individual parts to number literals and then concatenate
these literals with the appropriate separator characters. (Unless you have
the two timestamps constrained not to be more than 23 hours and 59 minutes
apart, you'd also need to cater for days and maybe months and years as well.
There might be a UDF around that could do it; or you could write a stored
procedure that gets called by a Before Update trigger when the second date
is written, calculates the dd:hh:mm string you want and passes it back for
storage in a character field, e.g. time_interval char(8).
./heLen
>What does ( Date 1 - Date 2 ) produce, I see a result as suchThe result is in days.
>0.590934534 etc....
>Could someone please explain?
>What I am trying to achieve is to get the hours and minutes between twoTimestamp, yes?
>date entries.
>
>Both date entries are in the format where date and time is recorded.
>The calculation should take into account the date part as well meaningThe result of subtracting or adding date or time types is an interval, in
>that the hours calculated can exceed 24.
>
>
>The best solution would be if the Calculation would be done in a
>computed field.
days. To store it like you want, you would first have to calculate that
number into hours and minutes, discarding the rest; do some parsing to
convert these individual parts to number literals and then concatenate
these literals with the appropriate separator characters. (Unless you have
the two timestamps constrained not to be more than 23 hours and 59 minutes
apart, you'd also need to cater for days and maybe months and years as well.
There might be a UDF around that could do it; or you could write a stored
procedure that gets called by a Before Update trigger when the second date
is written, calculates the dd:hh:mm string you want and passes it back for
storage in a character field, e.g. time_interval char(8).
./heLen