[Lazarus-es] trabajando con horas

José Mejuto joshyfun en gmail.com
Lun Oct 18 00:03:33 CEST 2010


Hello Paola,

Sunday, October 17, 2010, 8:04:32 PM, you wrote:

PB>   Hola a todos..
PB> necesito la ayuda experta de Uds..
PB> Tengo una tabla en Firebird con campos de este tipo, donde se guardan
PB> las hs trabajadas diariamente.
PB> HS_OPERARIO TIME
PB> ......
PB> Necesito hacer un reporte donde obtener obviamente la suma de horas por
PB> vehiculo, y a la vez una suma total.

Prueba con esta "chapuza" :

Select
  Cast(secs/3600 - 0.499999999999 as INTEGER) as Hours,
  Cast((secs - Cast(secs/ 3600 - 0.499999999999 as INTEGER)*3600)/ 60 - 0.499999999999 as INTEGER) as Minutes,
  secs- (Cast(secs/3600 - 0.499999999999 as INTEGER)*3600+Cast((secs - Cast(secs/ 3600 - 0.499999999999 as INTEGER)*3600)/ 60 - 0.499999999999 as INTEGER)*60) as Seconds
  from (
select SUM(TIME_FIELD - cast('0:0' as time)) as secs
from TTABLE )

-- 
Best regards,
 José





More information about the Lazarus-es mailing list