Skip to main content

to_date

Function to_date 

Source
pub fn to_date<'a, V, E, F>(
    expr: E,
    format: F,
) -> SQLExpr<'a, V, <V::DialectMarker as DialectTypes>::Date, E::Nullable, <E::Aggregate as AggOr<F::Aggregate>>::Output>
where V: SQLParam + 'a, V::DialectMarker: PostgresDateTimeSupport, E: Expr<'a, V>, E::SQLType: Textual, F: Expr<'a, V>, F::SQLType: Textual, E::Aggregate: AggOr<F::Aggregate>,
Expand description

TO_DATE - parses a date from text using a format pattern (PostgreSQL).

Returns Date type, preserves nullability of the input expression.

ยงExample

use drizzle_core::expr::to_date;

// SELECT TO_DATE('2024-01-15', 'YYYY-MM-DD')
let d = to_date("2024-01-15", "YYYY-MM-DD");