pub fn to_char<'a, V, E, F>(
expr: E,
format: F,
) -> SQLExpr<'a, V, Text, E::Nullable, Scalar>Expand description
TO_CHAR - formats a temporal expression as text (PostgreSQL).
Returns Text type, preserves nullability of the input expression.
§Common Format Patterns
YYYY- 4-digit yearMM- month (01-12)DD- day of month (01-31)HH24- hour (00-23)MI- minute (00-59)SS- second (00-59)Day- full day nameMonth- full month name
§Example
ⓘ
use drizzle_core::expr::to_char;
// SELECT TO_CHAR(users.created_at, 'YYYY-MM-DD')
let formatted = to_char(users.created_at, "YYYY-MM-DD");