Home arrow Documentation arrow API Reference arrow Global variables and functions
Home
FAQ
Documentation
Forums
License Key
Global variables and functions Print



Globals
These are variables and functions that can be used in any script in which you have included the calendar object.


Global Variables
Variables that can be used in any script in which you have included the calendar object.


array _cal_weekdays
A global array that holds weekday names starting at Sunday. E.g.

echo($_cal_weekdays[5]);
Would print Friday.


array _cal_weekdays_abbr
Exactly like _cal_weekdays except that weekdays are abbreviated to 3 letters.


array _cal_months
A global array that holds month names starting at 1 => January. E.g.
   
echo($_cal_months[2]);
Would print February. However:
   
echo($_cal_month[0]);
Would print nothing since the array starts at 1.


array _cal_months_abbr
Exactly like _cal_months except that months are abbreviated to 3 letters.


Global Functions
Global functions available in any script in which the calendar object is included.


int _ex_strtotime( string date )
_ex_strtotime will accept a multitude of date formats and returns the timestamp for the given date in GMT. This timestamp is usually passed to format_date(). The following produce the same dates:
  • 11/2/04 (if _CAL_EURO_DATE_ is defined, it would be 2/11/2004)
  • 2004-11-2
  • november 2 2004

It will also do date math:
  • +3 months
  • +8 weeks
  • 11/2/1976 +45 years
  • -3 days


  • Note that the operator (+ or -) must be immediately followed by a number. Also note the keyword must be plural. E.g. "+1 days" NOT "+1 day". This will u se the current date as a base, no matter what date the calendar is on. If it is at November of 1982 and you want to get the timestamp for December 1982. Using math you would pass it "Nov 1982 +1 month" not just "+1 month" which would give you 1 month from now, not 1 month from Nov 1982. Of course, you could just pass it "Dec 1982." This is just an example.
E.g.
   echo($cal->format_date('"l", _ex_strtotime("2004-12-17")));
Would print Friday

_CAL_EURO_DATE_ will affect all this function so that if it is defined and you pass it a date such as 11/2/2004, it will read the date as the 11th of February 2004. In all language files except for English (US), _CAL_EURO_DATE_ is defined.


int _ex_localtime( void )
This returns the local time in timestamp format. The local time is calculated based on the calendar's timezone and DST settings. This should only be used when referring to right now. Otherwise, use _ex_strtotime().