pandas / 1.4.0 / reference / api / pandas.timestamp.isoformat.html /

pandas.Timestamp.isoformat

Timestamp. isoformat ( )

Return the time formatted according to ISO 8610.

The full format looks like ‘YYYY-MM-DD HH:MM:SS.mmmmmmnnn’. By default, the fractional part is omitted if self.microsecond == 0 and self.nanosecond == 0.

If self.tzinfo is not None, the UTC offset is also attached, giving giving a full format of ‘YYYY-MM-DD HH:MM:SS.mmmmmmnnn+HH:MM’.

Parameters
sep :str, default ‘T’

String used as the separator between the date and time.

timespec :str, default ‘auto’

Specifies the number of additional terms of the time to include. The valid values are ‘auto’, ‘hours’, ‘minutes’, ‘seconds’, ‘milliseconds’, ‘microseconds’, and ‘nanoseconds’.

Returns
str

Examples

>>> ts = pd.Timestamp('2020-03-14T15:32:52.192548651')
>>> ts.isoformat()
'2020-03-14T15:32:52.192548651'
>>> ts.isoformat(timespec='microseconds')
'2020-03-14T15:32:52.192548'

© 2008–2022, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team
Licensed under the 3-clause BSD License.
https://pandas.pydata.org/pandas-docs/version/1.4.0/reference/api/pandas.Timestamp.isoformat.html