Your path to becoming an Ethical Hacker! Hacking Academy Try It Now!

PHP Calendar Functions

Explore PHP calendar functions for date conversions, including Julian, Gregorian, and Unix timestamps. Perfect for web developers working with dates.
The calendar extension has functions to change calendar dates into different formats. The standard date is based on the Julian Day Count, which starts from January 1, 4713 B.C. To convert a date, it is first changed to a Julian Day Count and then to a calendar system.

PHP Calendar Functions

Example: The program below shows how to use the jdtofrench() function in PHP.

<?php
// PHP program to demonstrate the
// use of jdtofrench() function
 
// converts date to julian integer
$jd = frenchtojd(1, 7, 13);
 
// prints the julian day integer
echo "The julian day integer is ", $jd, "\n";
 
// converts the Julian day to French date
$date = jdtofrench($jd);
 
// prints the date
echo "The french date initially taken was ", ($date), "\n";
 
?>

Output:

The julian day integer is 2380229
The french date initially taken was 1/7/13

The complete list of calendar functions are given below:

PHP Calendar Functions Description
cal_days_in_month() Return the number of days in a month for a specific year.
cal_from_jd() Returns the array containing calendar information of the specified calendar.
cal_info() Return information about a specified calendar.
cal_to_jd() Convert a specified date into Julian Day Count.
easter_date() Returns the Easter date in the year passed as an argument.
easter_days() Returns the number of days after March 21 that the Easter Day is in the given year.
frenchtojd() Convert the date in the French Republican calendar and converts it to a Julian Day count.
gregoriantojd() Converts a Gregorian date to a Julian Day Count.
jddayofweek() Returns the given day of the week of a Julian integer passed in the argument.
jdmonthname() Returns the month name of a Julian day number passed as the argument.
jdtofrench() Converts a Julian Day Integer to a French date.
jdtogregorian() Converts a Julian Day Integer to a Gregorian date.
jdtojulian() Convert a Julian day count to a Julian calendar date.
jdtounix() Convert a Julian day date into a Unix Timestamp.
jewishtojd() Converts a Jewish Date to a Julian Day Count.
juliantojd() Convert Julian calendar Date to Julian Day count.
unixtojd() Converts the Unix timestamp to Julian Day count.

Post a Comment

Oops!
It seems there is something wrong with your internet connection. Please connect to the internet and start browsing again.
AdBlock Detected!
We have detected that you are using adblocking plugin in your browser.
The revenue we earn by the advertisements is used to manage this website, we request you to whitelist our website in your adblocking plugin.
Cookie Consent
We serve cookies on this site to analyze traffic, remember your preferences, and optimize your experience.