Timestamp formatting

I really don’t know other than you tell you I just exactly replicated your code above again and the output was exactly correct.

Have you checked your time and time zone info to make sure that HA matches your computer and your real world time?