Skip to content

Glossary: Python Beyond the Basics

format codes (dates)

Also written: %Y, %m, %d, %H, strftime, strptime

Short codes like `%Y` (year) and `%H` (hour) used to describe a date's layout. `strftime` turns a datetime into text and `strptime` reads text into a datetime.

Where the book teaches it

Related terms

datetime / timedelta