InterviewStack.io LogoInterviewStack.io

Date and Time Operations Questions

Tests practical skills for working with dates and times in data, reporting, and everyday technical work. Candidates should be comfortable with date and time data types (date vs. timestamp vs. timestamp with time zone) and their storage and comparison semantics, date filtering, relative date ranges such as last-n-days or rolling windows, inclusive versus exclusive range boundaries, timezone conversions and daylight saving time edge cases, business-day and holiday-aware calculations, epoch/unix timestamp conversions, and fiscal or custom period logic. Interviewers assess the ability to translate a reporting or business requirement into correct date logic, choose the right date/time representation for a given system, and reason through common pitfalls such as timezone mismatches between systems and off-by-one boundary errors. This shows up across contexts: SQL queries, spreadsheet formulas, BI tool calculated fields and filters, and date/time handling in general-purpose code.

HardTechnical
52 practiced
Given an event stream (user_id, event_ts UTC, event_type), implement SQL to sessionize events per user with a 30-minute inactivity timeout. Additionally, only count time that falls within business hours (09:00-18:00) local to the user. Return average session length per user in minutes. Outline how you handle events that cross business-hour boundaries and DST transitions.
MediumTechnical
44 practiced
Stakeholder request: 'Send me the last 7 days' data. Clarify and implement both SQL examples: (A) last 7 rolling days including today, and (B) last 7 complete days excluding today. Also explain how to configure a BI tool relative date filter to match each behavior.
MediumTechnical
46 practiced
Given table events(event_date date, revenue numeric), write an ANSI/Postgres SQL query that returns the date and its 7-day rolling average of daily revenue. Explain how you handle missing dates (days with zero revenue) so the rolling average is computed over actual calendar days.
MediumTechnical
66 practiced
Explain inclusive vs exclusive date ranges for reporting (for example, should a daily report use created_at >= '2024-01-01' AND created_at <= '2024-01-31' or created_at >= '2024-01-01' AND created_at < '2024-02-01'?). Give examples of bugs that can occur when mixing approaches and recommend a best practice for timestamp-based comparisons in BI SQL queries.
EasyTechnical
57 practiced
An imported CSV has dates in a column that are mixed: numeric Excel serials like 44561, text '2020-01-01', and some improperly parsed '01/02/20'. Describe a robust set of steps or Excel formulas to normalize this column to proper Excel date values, considering Excel epoch differences (1900 vs 1904) and two-digit year ambiguity.

Unlock Full Question Bank

Get access to hundreds of Date and Time Operations interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.