pub fn date_trunc<'a, V, P, E>(
precision: P,
expr: E,
) -> SQLExpr<'a, V, Timestamp, E::Nullable, Scalar>Expand description
DATE_TRUNC - truncates a timestamp to specified precision (PostgreSQL).
Truncates the timestamp to the specified precision. Common values: ‘microseconds’, ‘milliseconds’, ‘second’, ‘minute’, ‘hour’, ‘day’, ‘week’, ‘month’, ‘quarter’, ‘year’, ‘decade’, ‘century’, ‘millennium’
Preserves the nullability of the input expression.
§Example
ⓘ
use drizzle_core::expr::date_trunc;
// SELECT DATE_TRUNC('month', users.created_at)
let month_start = date_trunc("month", users.created_at);