# xarray.core.accessor_dt.DatetimeAccessor.strftime

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

Return an array of formatted strings specified by date_format.

The format 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('c5f80d3a-c25d-4aa7-b4f6-33df4eedc353','d7af6897-509f-4757-8164-9bf1e44b90fa','d10ca474-d07b-4d21-8699-85447b06a6b9','../lite/tree/../notebooks/index.html?path=fdf36d64_910b_47b8_99e8_9cea41bb441a.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="d10ca474-d07b-4d21-8699-85447b06a6b9" class="try_examples_outer_iframe  hidden"><div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesHideIframe('c5f80d3a-c25d-4aa7-b4f6-33df4eedc353','d10ca474-d07b-4d21-8699-85447b06a6b9')">Go Back</button><button class="try_examples_button" onclick="window.openInNewTab('c5f80d3a-c25d-4aa7-b4f6-33df4eedc353','d10ca474-d07b-4d21-8699-85447b06a6b9')">Open In Tab</button></div><div id="d7af6897-509f-4757-8164-9bf1e44b90fa" class="jupyterlite_sphinx_iframe_container"></div></div><script>document.addEventListener("DOMContentLoaded", function() {window.loadTryExamplesConfig("../try_examples.json");});</script>
