# xarray.date_range_like

### xarray.date_range_like(source, calendar, use_cftime=None)[[source]](https://github.com/pydata/xarray/blob/main/xarray/coding/cftime_offsets.py#L1499-L1587)

Generate a datetime array with the same frequency, start and end as
another one, but in a different calendar.

* **Parameters:**
  * **source** ([`DataArray`](xarray.DataArray.html.md#xarray.DataArray), [`CFTimeIndex`](xarray.CFTimeIndex.html.md#xarray.CFTimeIndex), or `pd.DatetimeIndex`) – 1D datetime array
  * **calendar** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – New calendar name.
  * **use_cftime** ([`bool`](https://docs.python.org/3/builtins/functions.html#bool), *optional*) – If True, the output uses [`cftime.datetime`](https://unidata.github.io/cftime/api.html#cftime.datetime) objects.
    If None (default), [`numpy.datetime64`](https://numpy.org/doc/stable/reference/arrays.scalars.html#numpy.datetime64) values are used if possible.
    If False, [`numpy.datetime64`](https://numpy.org/doc/stable/reference/arrays.scalars.html#numpy.datetime64) values are used or an error is raised.
* **Returns:**
  [`DataArray`](xarray.DataArray.html.md#xarray.DataArray) – 1D datetime coordinate with the same start, end and frequency as the
  source, but in the new calendar. The start date is assumed to exist in
  the target calendar. If the end date doesn’t exist, the code tries 1
  and 2 calendar days before. There is a special case when the source time
  series is daily or coarser and the end of the input range is on the
  last day of the month. Then the output range will also end on the last
  day of the month in the new calendar.
