# 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.

```python
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](https://www.ask-codey.com/glossary?category=python&level=3)

Updated: November 19, 2026

Source: https://www.ask-codey.com/glossary/date-format-code
