Data Cleaning Exercises

Module 7

Dates and time

Date-only values, format ambiguity, offsets, time-zone context and invalid-date quarantine.
  1. Compare instants, not timestamp text

    Parse timestamps with their offsets and compare the moments they describe. · 10 min

  2. Dates need a declared locale

    Parse slash dates only when the row declares its convention; quarantine the rest. · 10 min

  3. Instants, offsets and local time

    Store timestamps as instants, compare them correctly, and convert to local time only for display. · 10 min

  4. Impossible dates

    Quarantine dates that don't exist instead of letting a parser roll them over. · 6 min

Module 7 quiz

Practice questions: choose an answer and check it to see the explanation. Nothing here is timed or graded.

  1. 1. Why is 03/04/2026 risky without a declared locale?
  2. 2. Are 2026-01-02T03:00:00+02:00 and 2026-01-02T01:00:00Z the same instant?
  3. 3. A timestamp has no offset (2026-03-29 02:30). The rules say timestamps must carry an offset. What do you do?
  4. 4. Is 2026-02-30 a valid date?
  5. 5. Why convert timestamps to UTC for storage and comparison?
  6. 6. A date-only column (birth date) is converted to a midnight UTC timestamp and displayed in New York. What can go wrong?