Skip to main content

make_timestamp

Function make_timestamp 

Source
pub fn make_timestamp<'a, V, Y, Mo, D, H, Mi, S>(
    year: Y,
    month: Mo,
    day: D,
    hour: H,
    minute: Mi,
    second: S,
) -> SQLExpr<'a, V, <V::DialectMarker as DialectTypes>::Timestamp, <<<<Y::Nullable as Nullability>::Or<Mo::Nullable> as Nullability>::Or<D::Nullable> as Nullability>::Or<H::Nullable> as Nullability>::Or<<Mi::Nullable as Nullability>::Or<S::Nullable>>, <<<<Y::Aggregate as AggregateKind>::Or<Mo::Aggregate> as AggregateKind>::Or<D::Aggregate> as AggregateKind>::Or<H::Aggregate> as AggregateKind>::Or<<Mi::Aggregate as AggregateKind>::Or<S::Aggregate>>, (Y::Sources, (Mo::Sources, (D::Sources, (H::Sources, (Mi::Sources, S::Sources)))))>
Expand description

Builds a timestamp from its parts (MAKE_TIMESTAMP), on PostgreSQL.

Takes year, month, day, hour, minute and seconds; all must be numeric (seconds may have a fraction). The result is timestamp, nullable if any argument is.

ยงExamples

let ts = make_timestamp::<Value, _, _, _, _, _, _>(2024, 1, 15, 10, 30, 0.0);
assert_eq!(ts.sql(), "MAKE_TIMESTAMP ($1, $2, $3, $4, $5, $6)");