datetime_to_db#

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

Strip time zone for storing a datetime in the database.

Parameters:

time (Optional[datetime]) – The timezone-aware datetime in the UTC time zone, or None.

Returns:

None if the input was None, otherwise the same datetime but timezone-naive and thus suitable for storing in a SQL database.

Return type:

datetime.datetime or None