pub fn date_trunc<'a, V, P, E>(
precision: P,
expr: E,
) -> SQLExpr<'a, V, <E::SQLType as DateTruncPolicy<V::DialectMarker>>::Output, E::Nullable, <P::Aggregate as AggOr<E::Aggregate>>::Output>where
V: SQLParam + 'a,
V::DialectMarker: PostgresDateTimeSupport,
P: Expr<'a, V>,
P::SQLType: Textual,
E: Expr<'a, V>,
E::SQLType: DateTruncPolicy<V::DialectMarker>,
P::Aggregate: AggOr<E::Aggregate>,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);