4 ms·
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 sec
by dwringer 7y ago
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-mm-dd/1429/python https://www.programming-idioms.org/idiom/99/format-date-yyyy...
[2] https://docs.python.org/3/library/datetime.html#datetime.date.isoformat https://docs.python.org/3/library/datetime.html#datetime.dat...
- i_cant_speel 7y agoIt sounds like the person you responded to corrected it themselves.