Subject | Re: Time Elapsed inside Stored Procedure? |
---|---|
Author | Adam |
Post date | 2005-01-25T22:04:25Z |
--- In firebird-support@yahoogroups.com, "dr_bentonquest"
<bentonquest@m...> wrote:
while back, but converting the other way.
-- convert these time strings to timestamps.
-- I chose an arbitrary date
vdate1 = Cast(('1/1/2005' || Date1) as TIMESTAMP);
vdate2 = Cast(('1/1/2005' || Date2) as TIMESTAMP);
-- Make sure you handle span if it crosses over midnight
if (:vdate2 < :vdate1) then
begin
vdate2 = :vdate2 + 1;
end
-- get difference
hrs = (:vdate2 - :vdate1) * 24;
Adam
<bentonquest@m...> wrote:
>time2
> Hi there,
>
> I have this four variables: date1 and date2 are DATE, time1 and
> are VARCHAR(5) and contain a time value, which I know is alwaysI can't remember the syntax precisely, I did something similar a
> between '00:00' and '24:59'.
>
> I am looking for ideas on how to compute the time elapsed (in hours)
> between the two sets of variables.
>
> Thanks for any hints,
>
> -Benton
while back, but converting the other way.
-- convert these time strings to timestamps.
-- I chose an arbitrary date
vdate1 = Cast(('1/1/2005' || Date1) as TIMESTAMP);
vdate2 = Cast(('1/1/2005' || Date2) as TIMESTAMP);
-- Make sure you handle span if it crosses over midnight
if (:vdate2 < :vdate1) then
begin
vdate2 = :vdate2 + 1;
end
-- get difference
hrs = (:vdate2 - :vdate1) * 24;
Adam