O'Reilly logo

Core PHP Programming, Third Edition by Leon Atkinson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

14.2. Alternative Calendars

PHP offers a powerful way to convert dates from one calendar system to another. In order to do this, you must first convert a date into a Julian Day Count. You then convert that integer back into a date according to another calendar.

These functions require the calendar extension. You may load it dynamically, or compile it into PHP.

integer cal_days_in_month(integer calendar, integer month, integer year)

The cal_days_in_month function (Listing 14.13) returns the number of days in a month for a given calendar's month and year. Use one of the constants in Table 14.6 to specify the calendar.

Table 14.6. Calendar Type Constants
ConstantDescription
CAL_FRENCHFrench Republican Calendar
CAL_GREGORIANGregorian Calendar
CAL_JEWISH ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required