Subject Re: [firebird-support] difference between TIMESTAMPs
Author Martijn Tonies
Hi,

> I have two TIMESTAMP fields CHECKIN and CHECKOUT...I need to calculate
> the duration between them to use in report and also get a TOTAL of all
> durations...
>
> How do i SELECT a duration in propert format, like 01:20...
>
> I tried CAST(CHECKOUT - CHECKIN AS TIMESTAMP) but i have conversion
> error...

A duration is not a timestamp value. Time means "time of day", which
is different from "2 hours and 12 minutes". Imagine a duration of
"27 hours and 54 minutes", how would you fit this into a TIME datatype?
You cannot, because "time of day" is only from "0:00:00 to 23:59:59".
See the difference?

Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, NexusDB, Oracle &
MS SQL Server
Upscene Productions
http://www.upscene.com
My thoughts:
http://blog.upscene.com/martijn/
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com