In this article, you will learn how to get the day of the week. The jddayofweek() function does the job in PHP.
What is the syntax of the jddayofweek() function in PHP?
jddayofweek(jd,mode);
Parameter | Description |
---|---|
jd | The Julian day number – Required |
mode | Used to select the output of the day of the week. 0 – Default – Return as numeric digit like 0 (equal to Sunday), 1 (equals to Monday)… 1 – Return the weekday as String (Sunday, Monday, Tuesday…) 2 – Return the short form of the weekday (Sun, Mon, Tue…) |
Examples of the jddayofweek() function
Example 1. The following example returns the day of the week of 4th January 1998 (my birthday :-)).
<?php
$j_d=gregoriantojd(1,04,1998);
echo jddayofweek($j_d,1);
?>