xarray.CFTimeIndex.strftime

CFTimeIndex.strftime(date_format)

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

Index of formatted strings

Return type

Index

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')