Timestamp Format
- Last Updated: July 30, 2025
- 1 minute read
- DataDirect Connectors
- ODBC
- MongoDB 8.0
- Documentation
Attribute
TimestampFormat (tsf)
Purpose
Specifies the format in which the driver renders the MongoDB composite timestamp. This option allows you to specify the format of the MongoDB composite timestamp that is most appropriate for your use case.
Valid Values
0 | 1 | 2 | 3 | 4
Behavior
If set to 0 (hex), the driver renders the bytes comprising the timestamp value as a string of hexadecimal digits, echoing the storage format. For example, 000000001407AC1A.
If set to 1 (bigint), the driver renders the timestamp as a 64-bit integer. This setting is optimal if timestamps are used for ordering the result set in chronological order. For example, 1921918923461099520.
If set to, 2 (bson), the driver renders the value in the format used for serializing as BSON, as is used in the MongoDB shell. The format is the expression:
Timestamp(<t>, <i>)
where <t> is the number of seconds since the Unix epoch, and <i> is the sequence number. For example, Timestamp(447481620, 0).
If set to 3 (json), the driver renders the value in the format used for serializing as JSON. The format is:
{"t":<t>, "i":<i>}
where <t> is the number of seconds since the Unix epoch, and <y> is the sequence number. For example, {"t":447481620, "i":0}.
If set to 4 (text), the driver renders the timestamp as a pair of values. The first is the date and time portion. The second is the sequence number. For example, 1984-03-07T04:27:00, 0.
Default Value
1 (bigint)