jddayofweek
mixed jddayofweek(int JD, [int flag])
|
JD
|
Julian day count
|
|
flag
|
Integer flag indicating the format in which to display the day of the week
|
Gets the day of the week for the Gregorian calendar from the given Julian day count.
Returns:
Value representing the day of the week; 0 if the Julian day count is less than zero
Description:
jddayofweek() finds the day of the week for the Gregorian calendar date that corresponds to the specified Julian day count. The day of the week is returned as an integer or as the full or abbreviated name of the day.
The flag
parameter controls the format in which the day of the week is output. If the flag
argument is not set, flag
is 0. The flags are described in the following table.
|
0
|
Returns the day number as an integer (0 = Sunday, 1 = Monday, 2 = Tuesday, and so on).
|
|
1
|
Returns a string containing the name of the day of the week.
|
|
2
|
Returns a string containing a three-letter abbreviation of the name of the day of the week.
|
Note:
You may be wondering if the default value for flag
is 0 how the caller can tell the difference between an error and Sunday. The user uses the strict comparison operator (===); however, the function doesn't return FALSE on error. This function is poorly designed and only indicates that an error has occurred if the user doesn't give the function an argument. In this case, NULL is returned and a warning is generated.
Version:
3+, 4+
See also:
To get a Julian day count from another calendar system, see the various *tojd functions.
Example:
Find out on which days Christmas and NewYear's Day fall
$year = date ('Y'); // Find the current year
$xmas = gregoriantojd (12, 25, $year);
$new_years = gregoriantojd (1, 1, $year + 1);
echo 'Christmas is on a ', jddayofweek( $xmas, 1);
echo ' and New Year\'s Day is on a ', jddayofweek( $new_years, 1) . '.';
|