# xarray.CFTimeIndex.to_datetimeindex

`CFTimeIndex.``to_datetimeindex`(unsafe=False)

  If possible, convert this index to a pandas.DatetimeIndex.

  Parameters: | unsafe (bool) – Flag to turn off warning when converting from a CFTimeIndex with a non-standard calendar to a DatetimeIndex (default `False`).
  Returns: |
  Return type: | pandas.DatetimeIndex
  Raises: | `ValueError` – If the CFTimeIndex contains dates that are not possible in the standard calendar or outside the pandas.Timestamp-valid range.
  Warns: | RuntimeWarning – If converting from a non-standard calendar to a DatetimeIndex.

  Warning

  Note that for non-standard calendars, this will change the calendar type of the index. In that case the result of this method should be used with caution.

  Examples

      >>> import xarray as xr
      >>> times = xr.cftime_range('2000', periods=2, calendar='gregorian')
      >>> times
      CFTimeIndex([2000-01-01 00:00:00, 2000-01-02 00:00:00], dtype='object')
      >>> times.to_datetimeindex()
      DatetimeIndex(['2000-01-01', '2000-01-02'], dtype='datetime64[ns]', freq=None)