datetime_to_db#

safir.database.datetime_to_db(time)#

Strip time zone for storing a datetime in the database.

Parameters:

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

Returns:

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

Return type:

datetime.datetime or None