PySpark Dates
9 interview problems on parse, shift and compare dates, from easy to hard.
Learn Dates
- Parsing dates and timestamps · 4 min read. to_date, to_timestamp and date_format patterns, and why yyyy and YYYY are not the same.
- trunc / add_months · 4 min read. Truncate dates to the month or year and shift them by whole months, including month-end rules.
- rangeBetween · 6 min read. Window frames by value instead of row count: the last 7 calendar days, not the last 7 rows.
- Label Late Shipments · Easy · Dates, Null Handling, Conditional Logic
- Month Start, Month End and Due Dates · Medium · Dates, Filtering & Selection
- Late Data in the Raw Zone · Medium · Data Lake, Aggregations, Dates
- Iceberg Hidden Partition Layout · Medium · Lakehouse, Aggregations, Dates
- Fill Missing Dates (Calendar Spine) · Hard · Joins, Arrays, Aggregations, Dates, Null Handling, Filtering & Selection
- Monthly Retention by Cohort · Hard · Joins, Aggregations, Dates, Null Handling, Filtering & Selection
- Three-Day Login Streak · Hard · Window Functions, Aggregations, Dates, Filtering & Selection
- Trailing 3 Calendar Days (Range Frame) · Hard · Window Functions, Dates, Filtering & Selection
- Sessionize a Clickstream · Hard · Window Functions, Dates, Null Handling, Conditional Logic, Filtering & Selection
Browse
Topics: Window Functions · Joins · Aggregations · Pivot, Unpivot & Rollup · Arrays · Null Handling · Conditional Logic · Dates · Filtering & Selection · Strings · Data Lake · Lakehouse · Streaming · Data Prep for AI · Spark Performance
Difficulty: Easy · Medium · Hard · Learn · All problems · dbt practice