PHP jddayofweek() Function

In this chapter you will learn:

  1. Definition for PHP jddayofweek() Function
  2. Syntax for PHP jddayofweek() Function
  3. Parameter for PHP jddayofweek() Function
  4. Return value for PHP jddayofweek() Function
  5. Example - Return the weekday of 21th January, 2013

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.

Next chapter...

What you will learn in the next chapter:

  1. Definition for PHP jdmonthname() Function
  2. Syntax for PHP jdmonthname() Function
  3. Parameter for PHP jdmonthname() Function
  4. Return value for PHP jdmonthname() Function
  5. Example for PHP jdmonthname() Function
Home » PHP Tutorial » PHP Calendar Functions
PHP 5 Predefined Calendar Constants
PHP cal_days_in_month() Function
PHP cal_from_jd() Function
PHP cal_info() Function
PHP cal_to_jd() Function
PHP easter_date() Function
PHP easter_days() Function
PHP frenchtojd() Function
PHP gregoriantojd() Function
PHP jddayofweek() Function
PHP jdmonthname() Function
PHP jdtofrench() Function
PHP jdtogregorian() Function
PHP jdtojewish() Function
PHP jdtojulian() Function
PHP jdtounix() Function
PHP jewishtojd() Function
PHP juliantojd() Function
PHP unixtojd() Function