TechArena Community

TechArena Community (http://forums.techarena.in/)
-   Software Development (http://forums.techarena.in/software-development/)
-   -   Explain me about Calendar Functions in PHP! (http://forums.techarena.in/software-development/1313056.htm)

michaels 07-03-2010 01:13 AM

Explain me about Calendar Functions in PHP!
 
Hi friends,
I want to use the calendar in PHP. I have used the calendar in Java but I don't have much idea of using it in PHP. Actually I have recently started with the PHP programming language, so I don't have that much information about it. So please tell me about Calendar Functions in PHP.?? Any other information related to the topic would be grateful.!! :notworthy

Warner 07-03-2010 01:21 AM

Re: Explain me about Calendar Functions in PHP!
 
The calendar extension presents a series of functions to simplify converting between different calendar formats. They are based on a Julian Day Count. The Julian Day Count is a count from 1 January 4713 BC To convert between calendar systems, you must first convert to Julian Day Count, then type in the calendar of your choice. The Julian Day Count is very different from the Julian Calendar! I would like to tell some basic things that are important to know while coding the calendar. The Gregorian calendar is a minor correction to the Julian. In the Julian calendar every fourth year is a leap year in February Which has 29, not 28 days, but in the Gregorian, years divisible by 100 are not leap years unless they are also divisible by 400.

Deabelos 07-03-2010 01:25 AM

Re: Explain me about Calendar Functions in PHP!
 
The functions that are required for the calendar are available in the standard PHP module, which is always available. You do not need any external libraries but you have to compile php with it. To run these functions with PHP, you must compile with enable-calendar. The Windows version of PHP has support for this extension. You do not add any additional library to use these functions. NetBSD Installation for PHP5 :
  • pkg_add php5-calendar
Then to enable this module, add the following to php.ini which is usually in /usr/pkg/etc/php.ini :
  • extension=calendar.so

Solitario 07-03-2010 01:27 AM

Re: Explain me about Calendar Functions in PHP!
 
The predefined constants are defined by this extension, and are only available when the extension has been compiled into PHP or dynamically loaded at runtime. The following are the Predefined Constants :
  • CAL_GREGORIAN (integer)
  • CAL_JULIAN (integer)
  • CAL_JEWISH (integer)
  • CAL_FRENCH (integer)
  • CAL_NUM_CALS (integer)
  • CAL_DOW_DAYNO (integer)
  • CAL_DOW_SHORT (integer)

Viensterrr 07-03-2010 01:28 AM

Re: Explain me about Calendar Functions in PHP!
 
I am providing you with the following constants are available since PHP 4.3.0 :
  • CAL_EASTER_DEFAULT (integer)
  • CAL_EASTER_ROMAN (integer)
  • CAL_EASTER_ALWAYS_GREGORIAN (integer)
  • CAL_EASTER_ALWAYS_JULIAN (integer)
Whereas the following constants are available since PHP 5.0.0 :
  • CAL_JEWISH_ADD_ALAFIM_GERESH (integer)
  • CAL_JEWISH_ADD_ALAFIM (integer)
  • CAL_JEWISH_ADD_GERESHAYIM (integer)

Reegan 07-03-2010 01:30 AM

Re: Explain me about Calendar Functions in PHP!
 
The following are the Calendar Functions with their respective descriptions :
  • cal_days_in_month - Returns the number of days in a month for a year and a given schedule
  • cal_from_jd - Converts Julian Day Count to a supported calendar
  • cal_info - Returns information on a calendar
  • cal_to_jd - Converts a calendar to Julian Day Count
  • easter_date - Get Unix timestamp for midnight on Easter of a given year
  • easter_days - Returns the number of days between March 21 and Easter, for a given year
  • FrenchToJD - Converts a date from the French Republican calendar in days from the Julian calendar
  • GregorianToJD - Converts a Gregorian date in days from the Julian calendar
  • JDDayOfWeek - Returns the day of the week
  • JDMonthName - Returns the name of the month

Zecho 07-03-2010 01:32 AM

Re: Explain me about Calendar Functions in PHP!
 
Their are many functions that you need to convert the types of the calendar. The following are some more functions that are used while doing the coding of calendar :
  • JDToFrench - Converts from Julian Day dated French Republican calendar
  • JDToGregorian - Converts from Julian Day to Gregorian date
  • jdtojewish - Converts from Julian Day in the Jewish calendar date
  • JDToJulian - Converts from Julian Day dated Julian
  • jdtounix - Converts Julian Day to UNIX timestamp
  • JewishToJD - Converts a date in the Jewish calendar in days from the Julian calendar
  • JulianToJD - Converts a Julian Day in a number of Julian Day
  • unixtojd - Convert UNIX timestamp to Julian Day


All times are GMT +5.5. The time now is 02:37 PM.