MCPcopy Index your code
hub / github.com/mongodb/mongo-python-driver / as_datetime

Method as_datetime

bson/timestamp.py:117–123  ·  view source on GitHub ↗

Return a :class:`~datetime.datetime` instance corresponding to the time portion of this :class:`Timestamp`. The returned datetime's timezone is UTC.

(self)

Source from the content-addressed store, hash-verified

115 return f"Timestamp({self.__time}, {self.__inc})"
116
117 def as_datetime(self) -> datetime.datetime:
118 """Return a :class:`~datetime.datetime` instance corresponding
119 to the time portion of this :class:`Timestamp`.
120
121 The returned datetime's timezone is UTC.
122 """
123 return datetime.datetime.fromtimestamp(self.__time, utc)

Callers 6

test_datetimeMethod · 0.95
test_datetime_msMethod · 0.45
test_datetimeMethod · 0.45
test_datetimeMethod · 0.45
_encode_datetimemsFunction · 0.45

Calls

no outgoing calls

Tested by 5

test_datetimeMethod · 0.76
test_datetime_msMethod · 0.36
test_datetimeMethod · 0.36
test_datetimeMethod · 0.36