📅 datetime Format Codes (for strftime/strptime) Date Formatting Code Meaning Example %Y Year (4 digits) 2024 %y Year (2 digits) 24 %m Month (01-12) 10 %B Full month name October %b Short month name Oct %d Day of month (01-31) 22 %A Full weekday name Tuesday %a Short weekday name Tue %j Day of year (001-366) 296 Time Formatting Code Meaning Example %H Hour 24-hour (00-23) 14 %I Hour 12-hour (01-12) 02 %M Minute (00-59) 30 %S Second (00-59) 45 %p AM/PM PM %f Microsecond 000000 Common Datetime Combinations Format Example Output %Y-%m-%d 2024-10-22 %Y-%m-%d %H:%M:%S 2024-10-22 14:30:45 %B %d, %Y October 22, 2024 %m/%d/%Y 10/22/2024 %I:%M %p 02:30 PM %A, %B %d, %Y at %I:%M %p Tuesday, October 22, 2024 at 02:30 PM


← Back to where you were | → Start the course from the beginning