# spacepy.time.dtstr2iso

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

  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.

  Parameters
    dtstr sequence of str

      Date + time representation, format is fairly open.

  Returns
    isostr array of str

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

    UTC array of datetime.datetime

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

    offset array of int

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

  Other Parameters
    fmt str, optional

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