Skip to main content

timediff

Function timediff 

Source
pub fn timediff<'a, V, E1, E2>(
    time1: E1,
    time2: E2,
) -> SQLExpr<'a, V, <V::DialectMarker as DialectTypes>::Text, <E1::Nullable as NullOr<E2::Nullable>>::Output, <E1::Aggregate as AggOr<E2::Aggregate>>::Output>
where V: SQLParam + 'a, V::DialectMarker: SQLiteDateTimeSupport, E1: Expr<'a, V>, E1::SQLType: Temporal, E2: Expr<'a, V>, E2::SQLType: Temporal, E1::Nullable: NullOr<E2::Nullable>, E2::Nullable: Nullability, E1::Aggregate: AggOr<E2::Aggregate>,
Expand description

TIMEDIFF - computes the difference between two temporal values (SQLite 3.43+).

Returns a text representation of the time difference.

ยงExample

use drizzle_core::expr::timediff;

// SELECT TIMEDIFF(events.end_time, events.start_time)
let duration = timediff(events.end_time, events.start_time);