datetime_from_db#

safir.database.datetime_from_db(time: datetime) datetime#
safir.database.datetime_from_db(time: None) None

Add the UTC time zone to a naive datetime from the database.

Parameters:

time (Optional[datetime]) – The naive datetime from the database, or None.

Returns:

None if the input was none, otherwise a timezone-aware version of the same datetime in the UTC timezone.

Return type:

datetime.datetime or None