Subject Re: [firebird-support] How do I get the differences between 2 timestamps as a timestamp.
Author Cornie van Schoor

I am not sure if it is really "legal" and if it will always work, but
this works for me for now.

Period = dateadd(minute, datediff(minute, Start_Date, End_Date),
cast('30.12.1899 00:00' as Timestamp))

will change the Period to Integer and save the DateDiff(minute ...) in
it, when I have the time to convert the application



On 2013/06/04 02:13, Helen Borrie wrote:
> At 12:01 p.m. 4/06/2013, cornievs wrote:
> >I have the following table (Staff_Events)
> >
> >...
> >Start_Date TIMESTAMP,
> >End_Date TIMESTAMP,
> >Period TIMESTAMP,
> >....
> >
> >and need to set Period to the time difference between End_Date and
> Start_Date. End_Date will always be later than Start_Date. (Enforce by
> on Insert/Update triggers.)
> >
> >I know I can the get difference with DATEDIFF, but I need the result
> as a TimeStamp.
> It is not possible. The difference between two timestamps gives you a
> number representing days and parts thereof. Your Period column is the
> wrong type. Make it a CHAR of a suitable length and use an expression
> to convert the difference into the string you want.
> Helen Borrie, Support Consultant, IBPhoenix (Pacific)
> Author of "The Firebird Book" and "The Firebird Book Second Edition"
> __________________________________________________________

[Non-text portions of this message have been removed]