Skip to main content

current_timestamp

Function current_timestamp 

Source
pub fn current_timestamp<'a, V>() -> SQLExpr<'a, V, <V::DialectMarker as DialectTypes>::TimestampTz, NonNull, Scalar>
where V: SQLParam + 'a,
Expand description

CURRENT_TIMESTAMP - returns the current timestamp with time zone.

Works on both SQLite and PostgreSQL. Returns TimestampTz because the SQL standard defines CURRENT_TIMESTAMP as timestamp with time zone. On SQLite (without chrono) this maps to String; on PostgreSQL it maps to DateTime<Utc> (requires the chrono feature).

ยงExample

use drizzle_core::expr::current_timestamp;

// SELECT CURRENT_TIMESTAMP
let now = current_timestamp::<SQLiteValue>();