# xarray.DataArray.dt.strftime

#### DataArray.dt.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('28ae8d85-6a3c-4627-9660-8e5d5bec50e8','9c5d6aca-4e92-4652-b853-0e2a24569e16','a90346f1-8c0e-4627-857d-e91f0df3951a','../lite/tree/../notebooks/index.html?path=a8f61b07_f7f6_4b2f_a099_3342b6cd359f.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="a90346f1-8c0e-4627-857d-e91f0df3951a" class="try_examples_outer_iframe  hidden"><div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesHideIframe('28ae8d85-6a3c-4627-9660-8e5d5bec50e8','a90346f1-8c0e-4627-857d-e91f0df3951a')">Go Back</button><button class="try_examples_button" onclick="window.openInNewTab('28ae8d85-6a3c-4627-9660-8e5d5bec50e8','a90346f1-8c0e-4627-857d-e91f0df3951a')">Open In Tab</button></div><div id="9c5d6aca-4e92-4652-b853-0e2a24569e16" class="jupyterlite_sphinx_iframe_container"></div></div><script>document.addEventListener("DOMContentLoaded", function() {window.loadTryExamplesConfig("../try_examples.json");});</script>
