# xarray.core.accessor_dt.DatetimeAccessor.strftime

#### DatetimeAccessor.strftime(date_format)[[source]](https://github.com/pydata/xarray/blob/main/xarray/core/accessor_dt.py#L356-L387)

Return an array 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](https://docs.python.org/3/library/datetime.html#strftime-strptime-behavior)

* **Parameters:**
  **date_format** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – date format string (e.g. “%Y-%m-%d”)
* **Returns:**
  **formatted strings** (`same type as values`) – Array-like of strings formatted for each element in values

### Examples

<div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesShowIframe('961f9ff0-1b23-49c0-b207-e75f0461bc5c','26117055-b058-4088-8651-e39b5501dee1','cfac59ae-a445-4369-9ac6-56811292c8e5','../lite/tree/../notebooks/index.html?path=7fd4edaa_c6b0_4001_a495_4f9232656314.ipynb','None')">Try it in your browser!</button></div>
```pycon
>>> import datetime
>>> rng = xr.Dataset({"time": datetime.datetime(2000, 1, 1)})
>>> rng["time"].dt.strftime("%B %d, %Y, %r")
<xarray.DataArray 'strftime' ()> Size: 8B
array('January 01, 2000, 12:00:00 AM', dtype=object)
```

<div id="cfac59ae-a445-4369-9ac6-56811292c8e5" class="try_examples_outer_iframe  hidden"><div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesHideIframe('961f9ff0-1b23-49c0-b207-e75f0461bc5c','cfac59ae-a445-4369-9ac6-56811292c8e5')">Go Back</button><button class="try_examples_button" onclick="window.openInNewTab('961f9ff0-1b23-49c0-b207-e75f0461bc5c','cfac59ae-a445-4369-9ac6-56811292c8e5')">Open In Tab</button></div><div id="26117055-b058-4088-8651-e39b5501dee1" class="jupyterlite_sphinx_iframe_container"></div></div><script>document.addEventListener("DOMContentLoaded", function() {window.loadTryExamplesConfig("../try_examples.json");});</script>
