obspy.core.utcdatetime.UTCDateTime.isoformat

UTCDateTime.isoformat(sep='T')[source]

Return a string representing the date and time in ISO 8601 format.

Return type:

str

Returns:

String representing the date and time in ISO 8601 format like YYYY-MM-DDTHH:MM:SS.mmmmmm or, if microsecond is 0, YYYY-MM-DDTHH:MM:SS.

Example

>>> dt = UTCDateTime(2008, 10, 1, 12, 30, 35, 45020)
>>> dt.isoformat()
'2008-10-01T12:30:35.045020'
>>> dt = UTCDateTime(2008, 10, 1)
>>> dt.isoformat()
'2008-10-01T00:00:00'