function

DateTime

Convert a time to the text a date-and-time field stores.

Example

go
query.GreaterThan("publishedAt", query.DateTime(time.Now()))

Arguments

ArgumentTypeDescription
ttime.TimeThe moment to compare with. It is converted to UTC with milliseconds.

Returns

A string value such as 2026-09-29T14:05:00.000Z.

Value

How it works

Use it for date-and-time fields, createdAt, and updatedAt. Compare a date-only field with a "2006-01-02" string instead.

Full signature

Related types

  • Value

    An immutable scalar or list comparison operand.