Hacker News new | past | comments | ask | show | jobs | submit login

When I view that page[1] I see two different techniques listed, isoformat() being the second. The first is to use d.strftime('%Y-%m-%d').

In regard to the second, isoformat on a "datetime" will give increased resolution beyond "YYYY-MM-DD", but a "date" object only resolves year, month and day and such a call will indeed yield the correct output (per the linked documentation at [2]).

[1] https://www.programming-idioms.org/idiom/99/format-date-yyyy...

[2] https://docs.python.org/3/library/datetime.html#datetime.dat...




It sounds like the person you responded to corrected it themselves.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: