Subject | Re: Time difference between two date columns |
---|---|
Author | lysander4444 |
Post date | 2006-05-03T09:04:13Z |
--- In firebird-support@yahoogroups.com, Shariful Alam
<murad_mouri@...> wrote:
You could probably CAST it to a DATETIME, but that would bring the
same result as just substracting one date from another and multiplying
the result with 24.
select
ID_Field,
(EndDateField-StartDateField) * 24 "csm_HoursPassed"
from
Tablename
keep in mind that this result will be somewhat inprecise, because
every date will be evaluated as of midnight.
So, for example, "May 2nd 2006, 23:59" will have a timespan of 24
hours to "May 3rd 2006, 00:01"
ciao,
André
<murad_mouri@...> wrote:
> I need time difference between two date columns ina pure DATE-type does not contain an information about the hour.
> hour basis. How can I get this in sql statement?
You could probably CAST it to a DATETIME, but that would bring the
same result as just substracting one date from another and multiplying
the result with 24.
select
ID_Field,
(EndDateField-StartDateField) * 24 "csm_HoursPassed"
from
Tablename
keep in mind that this result will be somewhat inprecise, because
every date will be evaluated as of midnight.
So, for example, "May 2nd 2006, 23:59" will have a timespan of 24
hours to "May 3rd 2006, 00:01"
ciao,
André