1

To resolve the issue. There are two meanings Time: 12:20 and 23:55. How can add the values that-be at the outlet was 36:15.

Or how to keep these values in dB (Time) Time except that, were it possible addition?

Tim Cooper
  • 144,163
  • 35
  • 302
  • 261

3 Answers3

2

Firebird's data type TIME allows range between 00:00:00 and 24:00:00 only.

If you want to store arbitrary amount of time (say, in seconds) use INTEGER or NUMERIC datatype. Then convert it into time string format if needed.

Andrej Kirejeŭ
  • 4,966
  • 2
  • 24
  • 30
  • 1
    That sounds quite reasonable to me: a TIME[_OF_DAY] type is not the same as a DURATION type. – Shark8 Oct 13 '13 at 18:28
1

You can use TIMESTAMP in dialect 3

With this you can add 2 times.

Hugues Van Landeghem
  • 6,694
  • 3
  • 29
  • 55
0

i have code here convert seconds in integer

CREATE PROCEDURE P_CONVERT_TIME (
  V_TIME_INT INTEGER
)
RETURNS (
  V_TIME_STR VARCHAR(20)
)
AS
  DECLARE VARIABLE v_max_trans_hour integer;
  DECLARE VARIABLE v_max_trans_min integer;
  DECLARE VARIABLE v_max_trans_sec integer;
  DECLARE VARIABLE v_max_trans_sec_gross integer;
BEGIN
    v_max_trans_sec = cast(v_Time_Int as integer);
    v_max_trans_hour = coalesce(div(v_max_trans_sec, 3600), 0);
    if (v_max_trans_hour > 0) then
      v_max_trans_sec = v_max_trans_sec - (3600 * v_max_trans_hour);
    v_max_trans_min = coalesce(div(v_max_trans_sec, 60), 0);
    if (v_max_trans_min > 0) then
      v_max_trans_sec = v_max_trans_sec - (60 * v_max_trans_min);

    if (v_max_trans_hour > 0) then begin
       if (v_max_trans_hour < 10) then begin
        V_Time_Str ='0'||v_max_trans_hour||':'; end else
        V_Time_Str=v_max_trans_hour||':';
    end else  V_Time_Str='00:';

    if (v_max_trans_min > 0) then begin
       if (v_max_trans_min <10) then begin
        V_Time_Str =V_Time_Str ||'0'||v_max_trans_min||':'; end else
        V_Time_Str =V_Time_Str ||v_max_trans_min||':';
    end else V_Time_Str =V_Time_Str ||'00:';

    if (v_max_trans_sec > 0) then begin
       if (v_max_trans_sec <10) then begin
        V_Time_Str =V_Time_Str ||'0'|| v_max_trans_sec; end else
        V_Time_Str =V_Time_Str || v_max_trans_sec;

    end else V_Time_Str =V_Time_Str ||'00';
  suspend;
END
;