SmartQueryTools

Truncate Dates in CSV Files Online

Truncate date and timestamp columns in CSV files to a chosen precision — year, quarter, month, week, day, hour, or minute — directly in your browser. Rounds timestamps down to the start of each period. No upload required.

How to truncate Dates in CSV files

  1. Drop your file onto the upload area. The first date or timestamp column is selected for you, and the first 200 rows are shown.
  2. Check the "Column to truncate" choice. Each column is listed with its detected type, so you can see whether it loaded as a date, a timestamp or text.
  3. Pick the precision under "Truncate to": year, quarter, month, week, day, hour, minute or second. Month is the default.
  4. Choose "Replace column in place", or "Append as new column (keeps original)" and give the new column a name. The default name is the column name plus _trunc.
  5. Click Truncate Dates, check the preview, and download the result in the same format you uploaded.

Your file is processed locally in your browser and is never uploaded. The free limit is 50 MB per file; larger files work if your device has the memory for them.

Worked example

A support team exports ticket open times and wants a week column to count tickets per week in a pivot table, while keeping the exact open time for reference.

Input (CSV)

ticket_id,opened_at,priority
T-101,2026-06-03 14:20:00,high
T-102,2026-06-07 23:59:00,low
T-103,2026-06-08 08:05:00,medium
T-104,2026-06-12 17:40:00,high
T-105,,low

Settings

  • Column to truncate: opened_at
  • Truncate to: Week (Monday, as a date)
  • Output mode: Append as new column, named opened_week

Result

ticket_idopened_atpriorityopened_week
T-1012026-06-03 14:20:00high2026-06-01
T-1022026-06-07 23:59:00low2026-06-01
T-1032026-06-08 08:05:00medium2026-06-08
T-1042026-06-12 17:40:00high2026-06-08
T-105NULLlowNULL

Weeks start on Monday, so Wednesday 3 June and Sunday 7 June both fall in the week of Monday 1 June. A ticket opened a few minutes after midnight on Monday 8 June starts the next week. The missing open time stays empty. For year, quarter, month, week and day the new column holds plain dates. Hour, minute and second keep a time part.

Working with CSV files

CSV stores dates as text, so the result depends on how the column was recognised on load. ISO values such as 2026-06-03 14:20:00 and 2026-06-03T14:20:00 are read as timestamps. Day-first or month-first dates such as 15/03/2026 or 3/15/26 may or may not be detected, depending on the layout. The column picker shows the detected type next to each name, which is the quickest check before you run. Be careful with columns where every day is 12 or lower. A value like 03/04/2026 fits both layouts, and the loader applies one layout to the whole column, so confirm a few rows against the source.

If a column loaded as VARCHAR, the tool still tries to convert each value. It understands ISO-style text such as 2026-03-15 09:45. Values it cannot read, such as "15 Mar 2026 9:45am" or "3/15/26", become empty cells rather than causing an error. Run Date Parse first for those layouts. A column that holds only times of day, like 09:30:00, is offered because it looks temporal, but it has no date to anchor to and every row comes back empty. Empty CSV fields stay empty in the output.

Frequently Asked Questions

Why did some rows in my CSV come back empty after truncating?

Those values could not be read as timestamps. Mixed layouts in one column, 12-hour times with am/pm, and dates in m/d/yy form are the usual causes. Standardise them with Date Parse first.

Will the truncated CSV column show 00:00:00 at the end?

Not for year, quarter, month, week or day. Those precisions produce plain dates such as 2026-06-01. Hour, minute and second produce full timestamps.

What day does a truncated week start on?

Monday. Week truncation follows ISO weeks, so every value from Monday 00:00 to Sunday 23:59:59 maps to that Monday.

Does truncating round to the nearest period?

No. It always rounds down to the start of the period. 2026-06-30 23:59 truncated to month is 2026-06-01, not 2026-07-01.

What happens to values that are not valid dates?

They become empty (NULL) in the output. The run does not fail, so compare the number of empty cells before and after to spot parsing problems.

Related Tools

Count Values in CSV Files Online

Group and count rows by any column in CSV files directly in your browser. Sort by frequency or value to find the most common entries — no upload required.

Aggregate CSV Files Online

Group and aggregate CSV files by any column directly in your browser. Calculate sum, average, min, max, and count for any numeric column — no upload required.

Filter by Date Range CSV Files Online

Filter CSV files to rows within a date range using simple start and end date pickers. See a live match count before you apply the filter — no upload required, runs in your browser.

Truncate Dates in Excel Files Online

Truncate date and timestamp columns in Excel files to a chosen precision — year, quarter, month, week, day, hour, or minute — directly in your browser. Rounds timestamps down to the start of each period. No upload required.

Truncate Dates in Parquet Files Online

Truncate date and timestamp columns in Parquet files to a chosen precision — year, quarter, month, week, day, hour, or minute — directly in your browser. Rounds timestamps down to the start of each period. No upload required.

Truncate Dates in JSON Files Online

Truncate date and timestamp columns in JSON files to a chosen precision — year, quarter, month, week, day, hour, or minute — directly in your browser. Rounds timestamps down to the start of each period. No upload required.

CSV Viewer Online

View and inspect CSV files directly in your browser. Browse rows, check column names and data types — no upload required, your data stays on your device.

Convert CSV to Parquet Online

Convert CSV files to Parquet format directly in your browser. No upload required — your data never leaves your device.