Wednesday, November 4, 2020

PHP Calendar Functions

PHP Calendar Function


Hello dear readers! welcome back to another edition of our tutorial on PHP. In this tutorial guide, we are going to be discussing about the PHP Calendar Functions.

The calendar extension provides a series of functions to simplify the converting between the different calendar formats.

It is based on Julian Day Count. The Julian Day Count is a count of days beginning from January 1st, 4713 B.C. To convert between the calendar systems, you need to first convert to Julian Day Count, finally to the calendar system which you want.

Installation

In order to get these functions to work, you have to compile PHP with --enable- calendar.

Runtime Configuration

This calendar extension has no configuration directives defined in php.ini.


PHP Calendar Functions

The following below is the list of calendar functions supported by PHP with the earliest versions of PHP that supports these functions -

Sr.NoFunction & DescriptionPHP
1cal_days_in_month()

Returns the number of days in a month for a specified year and calendar

4
2cal_from_jd()

Converts a Julian day count into a date of a specified calendar

4
3cal_from_jd()

Returns information about a given calendar

4
4cal_to_jd()

Converts a date to Julian day count

4
5easter_date()

Returns the Unix timestamp for midnight on Easter of a specified year

3
6easter_days()

Returns the number of days after March 21, on which Easter falls for a specified year

3
7FrenchToJD()

Converts a French Republican date to a Julian day count

3
8GregorianToJD()

Converts a Gregorian date to a Julian day count

3
9JDDayOfWeek()

Returns the day of a week

3
10JDMonthName()

Returns a month name

3
11JDToFrench()

Converts a Julian day count to a French Republican date

3
12JDToGregorian()

Converts a Julian day count to a Gregorian date

3
13jdtojewish()

Converts a Julian day count to a Jewish date

3
14JDToJulian()

Converts a Julian day count to a Julian date

3
15jdtounix()

Converts a Julian day count to a Unix timestamp

4
16JewishToJD()

Converts a Jewish date to a Julian day count

3
17JulianToJD()

Converts a Julian date to a Julian day count

3
18unixtojd()

Converts a Unix timestamp to a Julian day count



In our subsequent tutorials, we are going to be discussing about the above listed functions.

PHP Calendar Constants

The following below is the list of constants available in PHP -

Sr.NoConstant & DescriptionPHP
1

CAL_GREGORIAN

Gregorian calendar

3
2

CAL_JULIAN

Julian calendar

3
3

CAL_JEWISH

Jewish calendar

3
4

CAL_FRENCH

French Republican calendar

3
5

CAL_NUM_CALS

3
6

CAL_DOW_DAYNO

3
7

CAL_DOW_SHORT

3
8

CAL_DOW_LONG

3
9

CAL_MONTH_GREGORIAN_SHORT

3
10

CAL_MONTH_GREGORIAN_LONG

3
11

CAL_MONTH_JULIAN_SHORT

3
12

CAL_MONTH_JULIAN_LONG

3
13

CAL_MONTH_JEWISH

3
14

CAL_MONTH_FRENCH

3
15

CAL_EASTER_DEFAULT

4
16

CAL_EASTER_DEFAULT

4
17

CAL_EASTER_ROMAN

4
18

CAL_EASTER_ALWAYS_GREGORIAN

4
19

CAL_EASTER_ALWAYS_JULIAN

4
20

CAL_JEWISH_ADD_ALAFIM_GERESH

5
21

CAL_JEWISH_ADD_ALAFIM

5
22

CAL_JEWISH_ADD_GERESHAYIM



Alright guys! This is where we are rounding up for this tutorial post. In our next tutorial guide, we are going to be discussing about PHP cal_days_in_month() Function.

Feel free to ask your questions where necessary and i will attend to them as soon as possible. If this tutorial was helpful to you, you can use the share button to share this tutorial.

Follow us on our various social media platforms to stay updated with our latest tutorials. You can also subscribe to our newsletter in order to get our tutorials delivered directly to your emails.

Thanks for reading and bye for now.
Share:

0 comments:

Post a Comment

Hello dear readers! Please kindly try your best to make sure your comments comply with our comment policy guidelines. You can visit our comment policy page to view these guidelines which are clearly stated. Thank you.