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.

MediumTechnical
45 practiced
Write SQL to perform cohort retention analysis where cohorts are defined by users' sign-up week and retention is measured by week-of-activity for the following 12 weeks. Show how to pivot the result into a cohort matrix (cohort_week vs week_offset with retention rates) and explain how to handle users with missing activity weeks.
HardTechnical
53 practiced
Write SQL logic to compute ISO week number and ISO year for dates around the year boundary (for example, 2019-12-30, 2019-12-31, 2020-01-01). Explain how ISO year may differ from calendar year and how to safely join ISO-week buckets across years when producing week-based reports.
EasyTechnical
44 practiced
A sales report requires a 'week' column. Explain differences between ISO week (ISO-8601) and a custom week starting on Sunday. Give SQL examples for computing both types of week numbers and week-year labels for dates around year boundaries (e.g., Dec 29, Dec 30, Jan 1). Outline how these differences affect aggregations and joins across year boundaries.
EasyTechnical
54 practiced
Stakeholders want all timestamps displayed in their local time zones on dashboards, but you store events in UTC. Explain a recommended data modeling approach: where should timezone conversion happen (DB, ETL, or visualization layer), what fields to store (UTC timestamp, original timezone, local timestamp), and pros/cons for each approach. Include how to handle users without a known timezone.
EasyTechnical
86 practiced
Describe a robust SQL expression (Postgres or BigQuery) to compute a person's age in years from a birth_date column that handles leap years and returns correct integer ages (i.e., age increments only after the birthday has passed in the current year). Explain why simple /365 approaches are incorrect and provide an example edge case.

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.