PHP gregoriantojd() Function
In this chapter you will learn:
- Definition for PHP gregoriantojd() Function
- Syntax for PHP gregoriantojd() Function
- Parameter for PHP gregoriantojd() Function
- Return value for PHP gregoriantojd() Function
- Example - Convert a Gregorian date to a Julian Day Count and back to a Gregorian date
Definition
The gregoriantojd() function converts a date from the Gregorian Calendar to a Julian Day Count.
Syntax
PHP gregoriantojd() Function has the following syntax.
gregoriantojd(month,day,year);
Parameter
Parameter | Is Required | Description |
---|---|---|
month | Required. | Month as a number from 1 to 12 |
day | Required. | Day as a number from 1 to 31 |
year | Required. | Year as a number between -4714 and 9999 |
Return
PHP gregoriantojd() Function returns a Julian Day number.
Example
Convert a Gregorian date to a Julian Day Count and back to a Gregorian date:
<?php//from j a va2s.c o m
$jd=gregoriantojd(6,20,2013);
echo $jd . "\n";
echo jdtogregorian($jd);
?>
The code above generates the following result.
Next chapter...
What you will learn in the next chapter:
- Definition for PHP jddayofweek() Function
- Syntax for PHP jddayofweek() Function
- Parameter for PHP jddayofweek() Function
- Return value for PHP jddayofweek() Function
- Example - Return the weekday of 21th January, 2013
Home » PHP Tutorial » PHP Calendar Functions