Skip to main content
`Ctrl`+`K`

# pandas.Timestamp.strftime

Timestamp.strftime(format)

  Return a formatted string of the Timestamp.

  This method converts a Timestamp to a string according to the given format string, using the same directives as the standard library’s `datetime.datetime.strftime()`.

  In addition to the standard directives, `%N` is supported to format the nanoseconds as a 9-digit zero-padded number.

  Parameters:
    format str

      Format string to convert Timestamp to string. See strftime documentation for more information on the format string: https://docs.python.org/3/library/datetime.html#strftime-and-strptime-behavior.

  See also

  `Timestamp.isoformat`

    Return the time formatted according to ISO 8601.

  `pd.to_datetime`

    Convert argument to datetime.

  `Period.strftime`

    Format a single Period.

  Examples

      >>> ts = pd.Timestamp('2020-03-14T15:32:52.192548651')
      >>> ts.strftime('%Y-%m-%d %X')
      '2020-03-14 15:32:52'

  Use `%N` to format nanoseconds:

      >>> ts.strftime('%Y-%m-%dT%H:%M:%S.%N')
      '2020-03-14T15:32:52.192548651'