SmartQueryTools

Calculate Date Difference in Parquet Files Online

Calculate the difference between two date or timestamp columns in Parquet files directly in your browser. Output in days, months, years, hours, minutes, or seconds — no upload required.

How to calculate Date Difference in Parquet files

  1. Drop your file onto the upload area. It is loaded into the in-browser engine and the first 200 rows are shown.
  2. Choose the start date column and the end date column. The tool preselects the first two date or timestamp columns it finds.
  3. Pick a unit: days, months, years, hours, minutes or seconds.
  4. Name the output column (the default is date_diff) and click Calculate Difference. The result is end minus start, added as the last column.
  5. Download the file 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 small hotel exports its bookings and wants the number of nights for each stay. One guest is still checked in, so the check-out date is blank.

Input (Parquet)

Parquet file (binary, columnar) — shown as a table with its schema

booking_idroom_typecheck_incheck_out
B-2201double2026-07-032026-07-06
B-2202twin2026-07-282026-08-02
B-2203single2026-08-142026-08-15
B-2204double2026-08-20NULL
B-2205suite2026-12-302027-01-04

Schema: booking_id VARCHAR, room_type VARCHAR, check_in DATE, check_out DATE

Settings

  • Start date column: check_in
  • End date column: check_out
  • Unit: days
  • Output column name: nights

Result

booking_idroom_typecheck_incheck_outnights
B-2201double2026-07-032026-07-063
B-2202twin2026-07-282026-08-025
B-2203single2026-08-142026-08-151
B-2204double2026-08-20NULLNULL
B-2205suite2026-12-302027-01-045

Each value is check_out minus check_in in whole days. Stays that cross a month or year end are counted correctly, as B-2202 and B-2205 show. The open booking has no check-out date, so its result is NULL. Had the unit been months, B-2202 would give 1 and B-2201 would give 0, because months are counted by calendar boundaries crossed.

Working with Parquet files

Parquet stores DATE and TIMESTAMP as real types, so no guessing happens. Both are converted to TIMESTAMP before the difference is taken. A DATE becomes midnight, and hours, minutes and seconds between two DATE columns are exact multiples of 24 hours. Microsecond timestamps keep their precision, but results are still whole units. 09:00:00.900 to 09:00:01.100 gives 1 second, because one second boundary is crossed.

Parquet columns that hold Unix epoch numbers, such as INT64 milliseconds, are not timestamps. The conversion fails for them. Convert them with Format Timestamp or the SQL Query tool first. Timestamp-with-time-zone columns are converted to plain timestamps before comparing, so check a few rows if your data spans a daylight-saving change. The result column is written as INT64. All other columns keep their original Parquet types. Timestamps stored in milliseconds, microseconds or nanoseconds are all read correctly, including legacy INT96 timestamps from older Spark and Hive jobs.

Frequently Asked Questions

My Parquet timestamps are stored as epoch milliseconds. Will this work?

Not directly. An INT64 epoch column is a number, not a timestamp, and cannot be cast. Convert it to a timestamp first with Format Timestamp or the SQL Query tool, for example with epoch_ms(col).

What type is the Parquet output column?

INT64. Every unit returns a whole number, including seconds.

How are months and years counted?

By calendar boundaries crossed, not by complete periods. 31 January to 1 February is 1 month, and 31 December to 1 January is 1 year. The same rule applies to hours and days: 23:00 to 01:00 the next day is 1 day. For exact elapsed time, use hours or seconds and divide.

What if the end date is earlier than the start date?

The result is negative. The tool always computes end minus start, so 3 July to 1 July gives -2 days. Swap the two columns if you want positive numbers.

Can I calculate age in years from a birth date?

Only roughly. You need a second date column to compare against, and years are counted by year boundaries, so someone born in December shows as a year older from 1 January. For exact ages, compare in days and divide by 365.25, or use the SQL Query tool.

Related Tools

Bin Column in Parquet Files Online

Bucket a numeric column in Parquet files into labelled ranges — equal-width bins or custom edges. Runs entirely in your browser.

Aggregate Parquet Files Online

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

Filter Parquet Files Online

Filter rows in Parquet files by column value, directly in your browser. Your data stays on your device.

Calculate Date Difference in CSV Files Online

Calculate the difference between two date or timestamp columns in CSV files directly in your browser. Output in days, months, years, hours, minutes, or seconds — no upload required.

Calculate Date Difference in Excel Files Online

Calculate the difference between two date or timestamp columns in Excel files directly in your browser. Output in days, months, years, hours, minutes, or seconds — no upload required.

Calculate Date Difference in JSON Files Online

Calculate the difference between two date or timestamp columns in JSON files directly in your browser. Output in days, months, years, hours, minutes, or seconds — no upload required.

Parquet Viewer Online

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

Convert Parquet to CSV Online

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