BUG: non-nano strftime returns wrong results
State: closed

- [ ] closes #50787 (Replace xxxx with the GitHub issue number)
- [ ] [Tests added and passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#writing-tests) if fixing a bug or adding a new feature
- [ ] All [code checks passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#pre-commit).
- [ ] Added [type annotations](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#type-hints) to new arguments/methods/functions.
- [ ] Added an entry in the latest `doc/source/whatsnew/vX.X.X.rst` file if fixing a bug or adding a new feature.


Labels:
name: Bug
name: Non-Nano
description: datetime64/timedelta64 with non-nanosecond resolution

Comments:
@jbrockmendel I don't think there's any prospect of getting this working before 2.0.0, or is there? OK with just raising an informative message? better than giving the wrong result imo 😄 
> better than giving the wrong result

Definitely.

It's a bit hacky, but what if we did something like

```
except ValueErrorOrWhatever:
    from pandas._libs.tslib import format_array_from_datetime
    values = np.array([self.value], dtype="i8")
    res = format_array_from_datetime(values, tz=self.tz, format=format, reso=self._creso)
    return res[0]
```
thanks - just tried that and got a long error ending with
```
  File "pandas/_libs/tslibs/timestamps.pyx", line 1417, in pandas._libs.tslibs.timestamps.Timestamp.strftime
    res, = format_array_from_datetime(values, tz=self.tz, format=format, reso=self._creso)
  File "pandas/_libs/tslib.pyx", line 207, in pandas._libs.tslib.format_array_from_datetime
    res = ts.strftime(format)
  File "pandas/_libs/tslibs/timestamps.pyx", line 1417, in pandas._libs.tslibs.timestamps.Timestamp.strftime
    res, = format_array_from_datetime(values, tz=self.tz, format=format, reso=self._creso)
  File "pandas/_libs/tslib.pyx", line 207, in pandas._libs.tslib.format_array_from_datetime
    res = ts.strftime(format)
  File "pandas/_libs/tslibs/timestamps.pyx", line 1417, in pandas._libs.tslibs.timestamps.Timestamp.strftime
    res, = format_array_from_datetime(values, tz=self.tz, format=format, reso=self._creso)
  File "pandas/_libs/tslib.pyx", line 207, in pandas._libs.tslib.format_array_from_datetime
    res = ts.strftime(format)
  File "pandas/_libs/tslibs/timestamps.pyx", line 1417, in pandas._libs.tslibs.timestamps.Timestamp.strftime
    res, = format_array_from_datetime(values, tz=self.tz, format=format, reso=self._creso)
  File "pandas/_libs/tslib.pyx", line 207, in pandas._libs.tslib.format_array_from_datetime
    res = ts.strftime(format)
  File "pandas/_libs/tslibs/timestamps.pyx", line 1413, in pandas._libs.tslibs.timestamps.Timestamp.strftime
    return self.to_pydatetime().strftime(format)
  File "pandas/_libs/tslibs/timestamps.pyx", line 1095, in pandas._libs.tslibs.timestamps._Timestamp.to_pydatetime
    cpdef datetime to_pydatetime(_Timestamp self, bint warn=True):
  File "pandas/_libs/tslibs/timestamps.pyx", line 1116, in pandas._libs.tslibs.timestamps._Timestamp.to_pydatetime
    return datetime(self.year, self.month, self.day,
RecursionError: maximum recursion depth exceeded while calling a Python object
```
Makes sense.  Next idea would be to do something like `self.replace(year=9996).strftime(...).replace("9996", str(self.year))`
maybe, but there'd be quite a lot of edge cases to take care of, and I'd be worried about rushing it
Agreed.
Maybe could handle the same subset of cases that array_strftime handles without recursing
looks like `Timestamp.__repr__` calls `strtime("%z")`.  can we support this case?