Use jddayofweek() with CAL_DOW_LONG to receive the full weekday name directly.
$jd = gregoriantojd(9, 14, 2026);
echo jddayofweek($jd, CAL_DOW_LONG);$day_number = cal_to_jd(CAL_GREGORIAN,5,4,2013);
$week_day = jddayofweek($day_number,0);
echo $week_day;
The output will be 6. jddayofweek($julianDay, $mode = CAL_DOW_DAYNO)
With the default CAL_DOW_DAYNO mode, the function returns 0 for Sunday, 1 for Monday, through 6 for Saturday. $week_day = jddayofweek($day_number,1);
The output will be Saturday
$week_day = jddayofweek($day_number,2);
The output will be Sat
Use jddayofweek() to return the name of the day:
$jd = gregoriantojd(9, 18, 2024);
echo jddayofweek($jd, 1); // Outputs: Wednesday
$jd = 2459583;
echo jddayofweek($jd, 0); // Outputs: 1
Author & Instructor at plus2net
I write and maintain practical tutorials on Python, PHP, SQL, JavaScript, HTML, jQuery, and web development at plus2net. The tutorials focus on clear explanations, working examples, and code that readers can test and adapt while learning.