PHP Tutorial - PHP jddayofweek() Function






Definition

The jddayofweek() function returns the day of the week.

Syntax

PHP jddayofweek() Function has the following syntax

jddayofweek(jd,mode);

Parameter

ParameterIs RequiredDescription
jdRequired.A Julian Day number
modeOptional.Specifies how to return the weekday.

mode can have one of the following values:

ValueDescription
0Default. Returns the weekday as an integer (0=Sunday, 1=Monday, etc.)
1Returns the weekday as a string (Sunday, Monday, etc.)
2Returns the weekday as a string, abbreviated form (Sun, Mon, etc.)




Return

PHP jddayofweek() Function returns the Gregorian weekday as a string or integer (depends on the mode parameter).

Example

Return the weekday of 21th January, 2013:


<?php
$jd=gregoriantojd(1,21,2013);
echo jddayofweek($jd,1);
?>

The code above generates the following result.