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

juliantojd()

Example

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

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

Definition and Usage

The juliantojd() function converts a date from the Julian Calendar to a Julian Day Number.

Note: While this function can handle dates as far back as 4713 B.C., the Julian calendar was introduced in 46 B.C. and did not become consistent until around 8 A.D. Additionally, the start of the year varied by culture, with not all cultures recognizing January as the first month. Today, the Gregorian calendar is used worldwide. To convert Gregorian dates to Julian Day Numbers, use the gregoriantojd() function.

Tip: Use the jdtojulian() function to convert a Julian Day Number back to a Julian date.

Syntax

juliantojd(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 -4713 and 9999.

Technical Details

Return Value:

Returns a Julian Day Number.

PHP Version:

4+