Create a Python :class:`~datetime.datetime` from this DatetimeMS object. :param codec_options: A CodecOptions instance for specifying how the resulting DatetimeMS object will be formatted using ``tz_aware`` and ``tz_info``. Defaults to :const:`~bson.codec
(
self, codec_options: CodecOptions[Any] = DEFAULT_CODEC_OPTIONS
)
| 98 | _type_marker = 9 |
| 99 | |
| 100 | def as_datetime( |
| 101 | self, codec_options: CodecOptions[Any] = DEFAULT_CODEC_OPTIONS |
| 102 | ) -> datetime.datetime: |
| 103 | """Create a Python :class:`~datetime.datetime` from this DatetimeMS object. |
| 104 | |
| 105 | :param codec_options: A CodecOptions instance for specifying how the |
| 106 | resulting DatetimeMS object will be formatted using ``tz_aware`` |
| 107 | and ``tz_info``. Defaults to |
| 108 | :const:`~bson.codec_options.DEFAULT_CODEC_OPTIONS`. |
| 109 | """ |
| 110 | return cast(datetime.datetime, _millis_to_datetime(self._value, codec_options)) |
| 111 | |
| 112 | def __int__(self) -> int: |
| 113 | return self._value |