Example 1 — Three Modes
Find the weekday for January 1, 2000 using each of the modes.
<?php
$jd = gregoriantojd(1, 1, 2000);
echo jddayofweek($jd), PHP_EOL;
echo jddayofweek($jd, CAL_DOW_DAYNO), PHP_EOL;
echo jddayofweek($jd, CAL_DOW_LONG), PHP_EOL;
echo jddayofweek($jd, CAL_DOW_SHORT), PHP_EOL; How It Works
- gregoriantojd() converts January 1, 2000 into a Julian Day number.
- Without a mode, jddayofweek() uses CAL_DOW_DAYNO and returns the number 6.
- In the numbers, 0 is Sunday, so 6 means Saturday.
- CAL_DOW_LONG and CAL_DOW_SHORT return Saturday and Sat.

