PHP | jdtounix( ) Function
The jdtounix() function in PHP is a built-in function which is used to convert a Julian day date into a Unix Timestamp. This function returns a Unix timestamp corresponding to the Julian Day which is used as a parameter or it returns FALSE if entered date is not inside the Unix epoch i.e Gregorian years between 1970 and 2037 or 2440588 <= Julian day date <= 2465342.
The jdtounix() function returns time according to the Universal Time Coordinated(UTC).
Syntax:
jdtounix($jd)
Parameters: The jdtounix() function in PHP accepts only one parameter $jd. This parameter specifies a Julian Day number between 2440588 and 2465342.
Return Value: It returns a Unix timestamp corresponding to the Julian Day which is used as a parameter or it returns FALSE if entered date is not inside the Unix epoch.
Errors And Exception:
- The Julian Date used as a parameter must be in the range of 2440588 – 2465342.
- The jdtounix() function ignores the decimal part of the julian day count and therefore it may give improper results in many cases.
Examples:
Input : $julian_date = gregoriantojd(01, 02, 1997);
echo jdtounix($julian_date);
Output : 852163200
Input : $julian_date = gregoriantojd(11, 21, 2017);
echo jdtounix($julian_date);
Output : 1511222400
Below programs illustrate the jdtounix() function:
Program 1:
<?php // converting Gregorian date to Julian date $julian_date = gregoriantojd(01, 02, 1997); // Converting Julian date to Unix Timestamp echo jdtounix($julian_date); ?> |
Output:
852163200
Program 2:
<?php // converting Gregorian date to Julian date $julian_date=gregoriantojd(11, 21, 2017); // Converting Julian date to Unix Timestamp echo jdtounix($julian_date); ?> |
Output:
1511222400
Reference:
http://php.net/manual/en/function.jdtounix.php
Recommended Posts:
- How to call a function that return another function in JavaScript ?
- How to get the function name inside a function in PHP ?
- How to get the function name from within that function using JavaScript ?
- D3.js | d3.rgb() Function
- D3.js | d3.lab() Function
- PHP | each() Function
- PHP | Ds\Map get() Function
- D3.js | d3.hcl() Function
- CSS | hsl() Function
- PHP | dir() Function
- PHP | Ds\Map put() Function
- PHP Ds\Set get() Function
- D3.js | d3.hsl() Function
- PHP | end() Function
- PHP | Ds\Map xor() Function
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



