Curriculum
Course: PHP Basic
Login

Curriculum

PHP Basic

PHP Install

0/1

PHP Casting

0/1

PHP Constants

0/1

PHP Magic Constants

0/1

PHP Operators

0/1

PHP Reference

0/276
Text lesson

gregoriantojd()

Example

Convert a Gregorian date to a Julian Day Count and then convert it back to a Gregorian date.

<?php
$jd=gregoriantojd(6,20,2007);
echo $jd . “<br>”;
echo jdtogregorian($jd);
?>

Definition and Usage

The gregoriantojd() function converts a date from the Gregorian Calendar to a Julian Day Count.

Note: Although this function can handle dates back to 4714 B.C., notice that the Gregorian calendar was not instituted until 1582, and some countries did not accept it until much later (Britain converted in 1752, USSR in 1918, and Greece in 1923). Most European countries used the Julian calendar prior the Gregorian.

 

Tip: Look at the jdtogregorian() function to convert a Julian Day Count to a Gregorian date.

Syntax

gregoriantojd(month,day,year);

Parameter Values

 

Parameter

Description

month

Required. Specifies the month as a number between 1 and 12.

day

Required. Specifies the day as a number between 1 and 31.

year

Required. Specifies the year as a number between -4714 and 9999.

Technical Details

Return Value:

Returns a Julian Day Number.

PHP Version:

4+