datetime_to_db#

safir.database.datetime_to_db(time)#

Strip time zone for storing a datetime in the database.

Parameters:

time (datetime | None) – 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