Date Format Code
noun
say it: “DAYT FOR-mat kohd” /ˈdeɪt ˈfɔrmæt ˈkoʊd/
A short code, such as %m for the month or %Y for a four-digit year, that describes one part of how a date is written.
What is a date format code?
A date format code describes one piece of how a date is written: %m is the month, %d the day, %Y a
four-digit year, %H the hour and %M the minute. Put together, "%m/%d/%Y" describes 07/23/2007, which tells
pandas exactly how to read the dates instead of guessing.
import pandas as pd
print(pd.to_datetime("07/23/2007", format="%m/%d/%Y")) # 2007-07-23 00:00:00
In a sentence
- “Each date format code in "%m/%d/%Y" names one part of 07/23/2007.”
- “The date format code %Y means a four-digit year, such as 2007.”
Level: Journeyman · More Python terms at this level
Updated