11.6 The ISO Standard for Dates
Let’s revisit the date that we looked at earlier in this section: July 4, 1976.
On that day, how many ways do you think people recorded the date?
- Some would have written it exactly as it’s shown in the paragraph above.
- Someone writing a check would have likely written “7/4/76”
- Someone else writing a check, however, could have switched the month and date: “4/7/76”
- Someone using a three-letter month abbreviation would have gone with “Jul 4, 1976”
- Military, police, and first responders might have written “04JUL76”
With so many acceptable date formats out there, how can we know which is the right one? Thankfully, the International Standards Organization (ISO) has come up with an answer for this. The ISO standard date format always goes from the longest time unit to the shortest – so for any of the dates above, that would be year first, followed by month, followed by date.
Note below that for value1, value2, and value3, pandas’ to_datetime() function gets the job done, always puting the resulting date in the YYYY-MM-DD format.

For value4, however, we get a slightly different result, as shown below.

As wonderful as computers are, and as good as they are at performing computations, they are still not able to read minds. In order to convert value4 into the date that we intend to reference here, we need to explicitly tell the to_datetime() function about its current format.
