timestamp – Tools for representing MongoDB internal Timestamps
Tools for representing MongoDB internal Timestamps.
class bson.timestamp.``Timestamp(time, inc)
Create a new Timestamp.
This class is only for use with the MongoDB opLog. If you need to store a regular timestamp, please use a datetime.
Raises TypeError if time is not an instance of :class: int or datetime, or inc is not an instance of int. Raises ValueError if time or inc is not in [0, 2**32).
| Parameters: |
|---|
as_datetime()Return a
datetimeinstance corresponding to the time portion of thisTimestamp.The returned datetime’s timezone is UTC.
incGet the inc portion of this
Timestamp.timeGet the time portion of this
Timestamp.
Previous topic
son – Tools for working with SON, an ordered mapping
Next topic
tz_util – Utilities for dealing with timezones in Python