PostgreSQL: Get Week Start Date
When I’m building reports that group data by week, or when I need to find the start of a week for scheduling, I constantly need to know Monday’s date (or Sunday’s, depending on your region). It’s more useful than you’d think—finding the “week containing this date” is a fundamental operation in business analytics. You might need to compare week-over-week metrics, flag anomalies that started this week, or schedule weekly reports that run on a specific day.
PostgreSQL’s DATE_TRUNC() function makes this trivial. One function call gives you the start of the week, and from there, you can calculate the end or any other week boundary you need.
Quick Answer: Use DATE_TRUNC(‘week’, …)
To get the start date of a week:
SELECT
event_date,
DATE_TRUNC('week', event_date)::DATE as week_start_monday,
(DATE_TRUNC('week', event_date)::DATE + 6) as week_end_sunday
FROM events
WHERE event_date IS NOT NULL
LIMIT 5;
Returns:
event_date | week_start_monday | week_end_sunday
------------|------------------|----------------
2026-02-21 | 2026-02-16 | 2026-02-22
2026-02-22 | 2026-02-16 | 2026-02-22
2026-02-23 | 2026-02-16 | 2026-02-22
DATE_TRUNC('week', ...) rounds down to Monday (ISO 8601).
How It Works
DATE_TRUNC rounds a date to a specified interval. 'week' truncates to Monday of that week. Add 6 days to get Sunday.
Different Approaches & When to Use Them
Approach 1: ISO Week (Monday Start)
SELECT
DATE_TRUNC('week', date_col)::DATE as monday_start
FROM table_name;
Standard ISO 8601.
Approach 2: US Week (Sunday Start)
SELECT
date_col - (EXTRACT(DOW FROM date_col)::INT) as sunday_start
FROM table_name;
For US-style (Sunday = day 0).
Approach 3: Get Week Boundaries
SELECT
DATE_TRUNC('week', date_col)::DATE as week_start,
DATE_TRUNC('week', date_col)::DATE + 6 as week_end
FROM table_name;
Both boundaries at once.
Real-World Example: Weekly Reporting
Group sales by week:
SELECT
DATE_TRUNC('week', sale_date)::DATE as week_start,
COUNT(*) as transactions,
SUM(amount) as weekly_revenue
FROM sales
WHERE EXTRACT(YEAR FROM sale_date) = 2026
GROUP BY DATE_TRUNC('week', sale_date)
ORDER BY week_start DESC;
FAQ
Q: Does DATE_TRUNC use Monday or Sunday as week start? A: Monday (ISO 8601). For Sunday start, use date arithmetic.
Q: How do I get last week’s start?
A: DATE_TRUNC('week', date_col)::DATE - INTERVAL '7 days'.
Q: How do I get start of current week?
A: DATE_TRUNC('week', CURRENT_DATE)::DATE.
Q: What about fiscal weeks? A: Use date arithmetic with your fiscal year start date.
Wrapping Up
Get week start date with DATE_TRUNC('week', date_col)::DATE. It uses Monday as week start (ISO 8601). Add 6 days for week end.
Related Articles
- Get Week Number from Date - Week numbering
- PostgreSQL Date Functions - Complete guide
- Group by Time Interval - Aggregation