TIMEDIFF
fun TIMEDIFF(columnA: KQLiteColumn<out DateTimeModifier?>, columnB: KQLiteColumn<out DateTimeModifier?>): KQLiteColumn<KQLiteDateTime>
The TIMEDIFF() function computes the time difference between two date/time values. It returns the result as a time string in the format (+|-)YYYY-MM-DD HH:MM:SS.SSS.
Example
val startTime = dateTimeColumn("start_time") // "2024-05-04 10:00:00"
val endTime = dateTimeColumn("end_time") // "2024-05-04 12:30:45"
// SELECT TIMEDIFF(end_time, start_time) FROM Events;
Events
.select(TIMEDIFF(Events.endTime, Events.startTime))
.execute() // Expected Result: "-0000-00-00 02:30:45.000"
// Using literal strings
// SELECT TIMEDIFF('15:00:00', '09:45:15')
select(TIMEDIFF(DATETIME("15:00:00"), DATETIME("09:45:15"))).execute() // Expected Result: "+0000-00-00 05:14:45.000"Content copied to clipboard
Return
A KQLiteColumn of type KQLiteDateTime representing the time difference.
Author
MOHAMMAD AZIM ANSARI
Parameters
column A
A KQLiteColumn representing the first date/time value.
column B
A KQLiteColumn representing the second date/time value.