spacepy.time.dtstr2iso(dtstr, fmt='%Y-%m-%dT%H:%M:%S')[source]

Convert a datetime string to a standard format

Attempts to maintain leap second representation while converting time strings to the specified format (by default, ISO8601-like.) Only handles a single positive leap second; negative leap seconds require no special handling and policy is for UTC-UT1 not to exceed 0.9.

dtstrsequence of str

Date + time representation, format is fairly open.

isostrarray of str

Representation of dtstr formatted according to fmt. Always a new sequence even if contents are identical to dtstr.

UTCarray of datetime.datetime

The closest-possible rendering of UTC time before or equal to dtstr.

offsetarray of int

Amount (in microseconds) to add to UTC to get the real time.

Other Parameters:
fmtstr, optional

Format appropriate for strftime() for rendering the output time.