Format dates and timestamps in CSV

How to choose a CSV date and timestamp format that keeps its meaning after export, sorting, sharing and reopening in a spreadsheet, with tradeoffs and caveats.

A CSV file stores dates and times as plain text. Nothing in the format marks a column as a date, a time zone or a precision. Whatever reads the file has to guess. This review covers which date and time formats hold their meaning when a CSV is exported, copied, shared or reopened, and when a format meant for people is the better choice.

Short answer: which format suits your use

For data that will be read by software, imported into a database or passed between systems, the most dependable option is an ISO 8601-style value: year, month and day in that order, followed by the time and an explicit offset or a Z for UTC, such as 2025-03-04T14:05:09Z. Its main benefit is that it is unambiguous. With a fixed width, sorting it alphabetically also sorts it by time.

The main tradeoff is readability. People scanning a report may find 03/04/2025 2:05 PM easier to read. That style depends on regional convention, though, and the same characters mean March 4 to a US reader and 3 April to many others. A practical compromise is to keep a machine-oriented column and, if people need it, add a separate column formatted for them.

A format written for people is the better choice when the file is a one-off report for a known audience in one region, will not be re-imported or calculated on, and the readers would otherwise have to translate the dates in their heads.

What changing the date format actually changes

Two different things are often both called the date format. The first is the stored text: the characters that are actually written into the CSV file. The second is how a spreadsheet displays a value it has already turned into a date. A spreadsheet can show a cell as 4-Mar-25 while its internal value stays the same. When the sheet is saved as CSV, though, the program writes out text, and the displayed form may be what ends up in the file.

Changing the stored text changes the data itself. Converting 2025-03-04T14:05:09Z to 03/04/2025 removes the time, the seconds and the time zone, and those cannot be recovered from the result. Changing only a spreadsheet's display format changes nothing in the file until it is saved again. Before deciding whether information has been lost, check which of the two happened.

The table below shows one moment written in several common ways. The values are worked examples, not test output.

Representation | Example | What it keeps | What it loses or leaves open
ISO 8601 with UTC marker | 2025-03-04T14:05:09Z | Date, time to the second, time zone | Nothing for this precision
ISO-style date and time without offset | 2025-03-04 14:05:09 | Date and time | Which time zone the time refers to
ISO date only | 2025-03-04 | Calendar date | Time of day and time zone
US-style date and time | 03/04/2025 2:05 PM | Date and time to the minute | Seconds and time zone; day/month order is ambiguous outside the US
Unix epoch seconds | 1741097109 | Exact instant, always UTC-based | Readability; needs conversion to be understood

Common ways meaning gets lost

  • Ambiguous day/month order: 03/04/2025 cannot be read correctly without knowing the writer's convention.
  • Missing time zone: a timestamp without an offset is a local time in an unknown place, which matters when data from several regions or servers is merged.
  • Dropped precision: rewriting to minutes or to a date only throws away detail that cannot be rebuilt.
  • Two-digit years: 25 relies on the reader's assumption about the century.
  • Mixed formats in one column: many import tools pick one way to parse a column, so mixed values may be misread or left as text.
  • Epoch unit confusion: epoch values can be in seconds, milliseconds or other units, and the column alone does not say which.

Will the dates stay usable after copying, sharing or reopening?

Opening a CSV in a spreadsheet is the step most likely to change dates without anyone noticing. Spreadsheet programs often recognize text that looks like a date and convert it, and how they read ambiguous values can depend on the computer's regional settings. If the file is then saved as CSV again, the dates may be rewritten in a different format than the original. Strings that only look like dates, such as part numbers or version codes, can be converted by mistake as well. The safer route is to bring the file in through the program's import tool, where columns can be set to text or a specific date order, rather than opening it directly.

Copying and pasting CSV text as plain text keeps the characters exactly as they are. The risk comes when the paste lands in a program that reinterprets it, such as a spreadsheet cell, which can convert the value the same way it does on open.

For searching and filtering, a consistent format matters more than which format it is. Someone searching for 2025-03 will not find dates written as 03/2025. A fixed-width ISO-style format allows prefix searches by year or month and correct alphabetical sorting. Formats that put the month or day first do not sort in time order as text.

Accessibility: how assistive technology such as a screen reader reads a date depends on the specific software, its settings and how the file is presented, whether as raw text, a spreadsheet grid or an HTML table. No scoped test or documentation for a named screen reader was available for this review, so no claim is made about how any one of them reads a given format. Where a CSV is shared directly with people who rely on assistive technology, a human-readable date column that spells out the month, such as 4 March 2025, removes the day/month ambiguity. It does not replace the machine-readable column.

A practical export pattern

When you control the export, write timestamps in UTC with an explicit marker, keep one format per column, and state the format and time zone in the column header or in accompanying notes. The Python snippet below shows one way to produce both a machine-oriented column and a column for readers.

from datetime import datetime, timezone

ts = datetime(2025, 3, 4, 14, 5, 9, tzinfo=timezone.utc)

machine = ts.strftime("%Y-%m-%dT%H:%M:%SZ")    # 2025-03-04T14:05:09Z
readable = ts.strftime("%d %B %Y, %H:%M UTC")  # 04 March 2025, 14:05 UTC
epoch = int(ts.timestamp())                     # 1741097109

Month names produced by %B depend on the locale setting of the environment running the code, so the readable column may differ between machines. The machine column does not have this problem.

Checklist before sharing a CSV with dates

  • Confirm every value in each date column uses the same format.
  • State the time zone, or use UTC with a Z or offset.
  • Keep the full precision the data needs; do not round to dates unless the time is truly irrelevant.
  • If epoch values are used, label the unit.
  • Test the file in the program the recipient will use, ideally through its import tool, and compare a few values against the source.
  • Avoid re-saving the CSV from a spreadsheet unless you have checked that the dates were not rewritten.

Limits of this review

No product-specific evidence, version details or test results were supplied for this article. The guidance here rests on general, verifiable properties of CSV as plain text and of common date conventions. How a particular spreadsheet program, database importer or assistive technology handles a given format was not tested, and behavior can vary with version and regional settings. Check the actual destination with a sample file before relying on any format.