xarray.CFTimeIndex.strftime#

CFTimeIndex.strftime(date_format)[source]#

Return an Index of formatted strings specified by date_format, which supports the same string format as the python standard library. Details of the string format can be found in python string format doc

Parameters:

date_format (str) โ€“ Date format string (e.g. โ€œ%Y-%m-%dโ€)

Returns:

pandas.Index โ€“ Index of formatted strings

Examples

>>> rng = xr.cftime_range(
...     start="2000", periods=5, freq="2MS", calendar="noleap"
... )
>>> rng.strftime("%B %d, %Y, %r")
Index(['January 01, 2000, 12:00:00 AM', 'March 01, 2000, 12:00:00 AM',
       'May 01, 2000, 12:00:00 AM', 'July 01, 2000, 12:00:00 AM',
       'September 01, 2000, 12:00:00 AM'],
      dtype='object')