Finding the weekday of a date in Python is straightforward using the weekday() and isoweekday() methods of a date or datetime object from the datetime module. These methods return the day of the week as an integer — weekday() uses 0 = Monday to 6 = Sunday, while isoweekday() follows the ISO standard with 1 = Monday to 7 = Sunday. In 2026, weekday calculation remains essential for scheduling, reporting, filtering data by day, determining weekends/holidays, and analytics — especially when working with timestamps in logs, financial data, user activity, or calendars.
Here’s a complete, practical guide to finding the weekday of a date: how the methods work, differences between them, real-world patterns, formatting weekdays as names, and modern best practices with type hints, pandas/Polars integration, and scalability.
Basic usage on a date object — create the date, then call the method.
from datetime import date
d = date(2026, 2, 10) # February 10, 2026 (a Tuesday)
print(d.weekday()) # 1 (0=Monday, 1=Tuesday, ..., 6=Sunday)
print(d.isoweekday()) # 2 (1=Monday, 2=Tuesday, ..., 7=Sunday)
Same methods work on datetime objects — they ignore the time portion and return the weekday of the date part.
from datetime import datetime
dt = datetime(2026, 2, 10, 14, 30)
print(dt.weekday()) # 1 (Tuesday)
print(dt.isoweekday()) # 2 (ISO Tuesday)
Real-world pattern: filtering or grouping data by weekday — very common in time-series analysis, user behavior, or business reporting.
import pandas as pd
df = pd.DataFrame({
'event_date': [date(2026, 1, 15), date(2026, 2, 10), date(2026, 3, 5)],
'sales': [100, 150, 200]
})
# Add weekday column (0=Monday)
df['weekday_num'] = df['event_date'].apply(lambda d: d.weekday())
df['weekday_iso'] = df['event_date'].apply(lambda d: d.isoweekday())
# Filter weekends (Saturday=5, Sunday=6 in weekday(); 6 and 7 in isoweekday())
weekends = df[df['weekday_num'] >= 5]
print(weekends)
Convert numeric weekday to name — use strftime() or a lookup list/dict for readability in reports or logs.
weekday_names = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"]
d = date(2026, 2, 10)
print(weekday_names[d.weekday()]) # Tuesday
# Or use strftime for full formatting
print(d.strftime("%A")) # Tuesday
print(d.strftime("%a")) # Tue (short)
Best practices make weekday calculation safe, readable, and performant. Prefer isoweekday() when following ISO standards (Monday=1) — more common in business/international contexts. Use vectorized pandas/Polars for large DataFrames — df['weekday'] = df['date'].dt.weekday or pl.col("date").dt.weekday() is 10–100× faster than apply(). Add type hints — date or datetime.date — improves readability and mypy checks. Modern tip: use Polars for huge timestamp data — pl.col("ts").dt.weekday() or .dt.isoweekday() is fast and lazy. Handle edge cases — invalid dates raise ValueError when creating date; wrap in try/except when parsing. Combine with timedelta — date.today() + timedelta(days=7) — for future/past weekday calculations. Use strftime("%A") or lookup for names — avoid manual mapping unless performance-critical.
Finding the weekday of a date is fast and reliable with weekday() or isoweekday() — essential for day-based logic, filtering, and reporting. In 2026, vectorize with pandas/Polars, use ISO weekday when standards matter, format names for display, and add type hints for safety. Master weekday calculation, and you’ll handle scheduling, analytics, and time-series data with precision and efficiency.
Next time you need to know what day of the week a date falls on — reach for weekday() or isoweekday(). It’s Python’s cleanest way to say: “Which day is this?” — Monday through Sunday.