PhpDig.net

What is PhpDig?
PhpDig is a PHP MySQL based
Web Spider & Search Engine.




jddayofweek

Name

jddayofweek — Gets the day of the week for the Gregorian calendar from the given Julian day count.

Synopsis

mixed jddayofweek(JD[, flag]);
int JD: Julian day count
int flag (optional): Integer flag indicating the format in which to display the day of the week

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.

Mode Result
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

PHP Version: 3+, 4+

See also

To get a Julian day count from another calendar system, see the various *tojd() functions.

Example

Example 73. Find out on which days Christmas and New Year'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) . '.';



PHP Functions Essential Reference. Copyright © 2002 by New Riders Publishing (Authors: Zak Greant, Graeme Merrall, Torben Wilson, Brett Michlitsch). This material may be distributed only subject to the terms and conditions set forth in the Open Publication License, v1.0 or later (the latest version is presently available at http://www.opencontent.org/openpub/). The authors of this book have elected not to choose any options under the OPL. This online book was obtained from http://www.fooassociates.com/phpfer/ and is designed to provide information about the PHP programming language, focusing on PHP version 4.0.4 for the most part. The information is provided on an as-is basis, and no warranty or fitness is implied. All persons and entities shall have neither liability nor responsibility to any person or entity with respect to any loss or damage arising from the information contained in this book.

Powered by: vBulletin Version 3.0.7
Copyright ©2000 - 2005, Jelsoft Enterprises Ltd.
Copyright © 2001 - 2005, ThinkDing LLC. All Rights Reserved.