time_day_of_week
Find the weekday for any proleptic-Gregorian date, list next or previous occurrences of that weekday, or measure the calendar distance between two dates in days and weeks. Supports years from -9999 to 9999.
Instructions
Day of Week Calculator. Find the weekday for any proleptic-Gregorian date, list the next or previous N occurrences of that weekday, or measure the calendar distance between two dates in days and weeks. Select the mode with the operation field (weekday, scan, distance). Use this for weekday lookups and recurring weekday schedules; use time_date_difference when you need business-day counts or to add or subtract a duration from a date. Supports years -9999 to 9999 including BCE (year 0 and negatives), with strict round-trip date validation. Pure local computation: read-only, non-destructive, contacts no external service, and is rate-limited (60 requests/minute for anonymous callers). Returns ISO 8601 date strings plus weekday name, indices, ISO week number, and day-of-year metadata.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| operation | Yes | Mode: weekday returns the weekday for one date; scan lists N recurring weekday dates; distance measures the gap between two dates. | |
| year | No | Year of the date (weekday and scan modes). BCE allowed via 0 and negative values. | |
| month | No | Month of the date (weekday and scan modes), 1 to 12. | |
| day | No | Day of month (weekday and scan modes); must be a real day for that month. | |
| count | No | Scan mode only. Non-zero signed count of same-weekday occurrences; positive scans forward, negative backward. | |
| fromYear | No | Distance mode only. Year of the start date. | |
| fromMonth | No | Distance mode only. Month of the start date, 1 to 12. | |
| fromDay | No | Distance mode only. Day of month of the start date. | |
| toYear | No | Distance mode only. Year of the end date. | |
| toMonth | No | Distance mode only. Month of the end date, 1 to 12. | |
| toDay | No | Distance mode only. Day of month of the end date. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| operation | No | The operation that was performed (weekday, scan, or distance). | |
| data | No | Result payload; fields depend on the operation. Weekday fields shown below; scan adds from/dayOfWeek/count/occurrences, distance adds from/to/days/weeks/weekRemainder/sameWeekday. |