Skip to main content

age

Function age 

Source
pub fn age<'a, V, E1, E2>(
    timestamp1: E1,
    timestamp2: E2,
) -> SQLExpr<'a, V, Interval, <E1::Nullable as NullOr<E2::Nullable>>::Output, <E1::Aggregate as AggOr<E2::Aggregate>>::Output>
where V: SQLParam + 'a, V::DialectMarker: PostgresDateTimeSupport, 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

AGE - calculates the interval between two timestamps (PostgreSQL).

Returns PostgreSQL INTERVAL. The result is nullable if either input is nullable.

ยงExample

use drizzle_core::expr::age;

// SELECT AGE(NOW(), users.created_at)
let user_age = age(now(), users.created_at);