julianday
использовать не рекомендуется а epoch
(a.k.a. strfime "%s"
все работает так как epoch это секунды с 01.01.1970 select CAST( strftime('%s',datetime(date_end, time_end ) ) AS LONG ), CAST( strftime('%s',datetime(date_start, time_start ) ) AS LONG) from _variables;
select STRFTIME("%H:%M:%S", CAST( strftime('%s',datetime(date_end, time_end ) ) AS LONG ) - CAST( strftime('%s',datetime(date_start, time_start ) ) AS LONG) )from _variables;
12:00:00
drop table IF EXISTS _Variables;
CREATE TEMP TABLE _Variables(date_end date, time_end time, date_start date, time_start time) ;
INSERT INTO _Variables VALUES ('2022-01-21', '13:00:00', '2022-01-21', '01:00:00');
select STRFTIME("%H:%M:%S", julianday(datetime(date_end, time_end )) - julianday(datetime(date_start, time_start ))) from _variables;
00:00:00