Computes the day of the week for any proleptic Gregorian calendar date.
Published for review. The Founder is checking every card himself; anything he strikes comes down the same hour.
Try it
Inputs
date (string, required) : ISO 8601 date, YYYY-MM-DD
Outputs
weekday: Name of the day of the week
Steps
Parse the date as a proleptic Gregorian civil date (year, month, day).
Compute its day-number using the Hinnant days_from_civil algorithm (equivalent to a Julian Day Number offset), which counts whole days since 1970-01-01.
Take the day-number modulo 7. 1970-01-01 has day-number 0 and was a Thursday, so the remainder indexes into the cycle starting at Thursday.
Map the remainder to a weekday name using that calibrated cycle.
chrono-Compatible Low-Level Date Algorithms (Howard Hinnant, 2026-09-30T19:41:35Z) - days_from_civil day-number kernel; 1970-01-01 is day-number 0 and is independently known to have been a Thursday