Closed pierrepo closed 7 years ago
Just as remember :
date, datetime, and time objects all support a strftime(format) method, to create a string representing the time under the control of an explicit format string.
Its behavior is describd here: https://docs.python.org/2/library/datetime.html#strftime-and-strptime-behavior
But for the requested format we will use :
Directive | Meaning | Example |
---|---|---|
%y | Year without century as a zero-padded decimal number. | 00, 01, ..., 99 |
%m | Month as a zero-padded decimal number. | 01, 02, ..., 12 |
%d | Day of the month as a zero-padded decimal number. | 01, 02, ..., 31 |
%H | Hour (24-hour clock) as a zero-padded decimal number. | 00, 01, ..., 23 |
%M | Minute as a zero-padded decimal number. | 00, 01, ..., 59 |
%S | Second as a zero-padded decimal number. | 00, 01, ..., 59 |
When upload/creation dates are display, use a shorter format:
"YY-MM-DD HH:MM:SS"