obspy.core.utcdatetime.UTCDateTime.__sub__

UTCDateTime.__sub__(value)[source]

Subtracts seconds and microseconds from current UTCDateTime object.

Parameters:value (int, float or UTCDateTime) Seconds or UTCDateTime object to subtract. Subtracting an UTCDateTime objects results into a relative time span in seconds.
Return type:UTCDateTime or float
Returns:New UTCDateTime object or relative time span in seconds.

Example

>>> dt = UTCDateTime(1970, 1, 2, 0, 0)
>>> dt - 2
UTCDateTime(1970, 1, 1, 23, 59, 58)
>>> UTCDateTime(1970, 1, 2, 0, 0) - 1.123456
UTCDateTime(1970, 1, 1, 23, 59, 58, 876544)
>>> UTCDateTime(1970, 1, 2, 0, 0) - UTCDateTime(1970, 1, 1, 0, 0)
86400.0