Class: Date_Calc
Source Location: /Date-1.4.2/Date/Calc.php
Date_Calc is a calendar class used to calculate and
Author(s):
Version:
|
|
Inherited Variables
|
Inherited Methods
|
Class Details
Method Detail
beginOfMonth [line 910]
string beginOfMonth(
[string
$month = ''], [string
$year = ''], [string
$format = '%Y%m%d'])
|
|
Return date of first day of month of given date.
Parameters:
beginOfNextMonth [line 324]
string beginOfNextMonth(
[string
$day = ''], [string
$month = ''], [string
$year = ''], [string
$format = '%Y%m%d'])
|
|
Returns date of begin of next month of given date.
Parameters:
beginOfNextWeek [line 1004]
string beginOfNextWeek(
[string
$day = ''], [string
$month = ''], [string
$year = ''], [string
$format = '%Y%m%d'])
|
|
Find the month day of the beginning of week after given date, using DATE_CALC_BEGIN_WEEKDAY. (can return weekday of prev month.)
Parameters:
beginOfPrevMonth [line 398]
string beginOfPrevMonth(
[string
$day = ''], [string
$month = ''], [string
$year = ''], [string
$format = '%Y%m%d'])
|
|
Returns date of the first day of previous month of given date.
Parameters:
beginOfPrevWeek [line 1046]
string beginOfPrevWeek(
[string
$day = ''], [string
$month = ''], [string
$year = ''], [string
$format = '%Y%m%d'])
|
|
Find the month day of the beginning of week before given date, using DATE_CALC_BEGIN_WEEKDAY. (can return weekday of prev month.)
Parameters:
beginOfWeek [line 936]
string beginOfWeek(
[string
$day = ''], [string
$month = ''], [string
$year = ''], [string
$format = '%Y%m%d'])
|
|
Find the month day of the beginning of week for given date, using DATE_CALC_BEGIN_WEEKDAY. (can return weekday of prev month.)
Parameters:
compareDates [line 792]
int compareDates(
string
$day1, string
$month1, string
$year1, string
$day2, string
$month2, string
$year2)
|
|
Compares two dates
Parameters:
dateDiff [line 766]
int dateDiff(
string
$day1, string
$month1, string
$year1, string
$day2, string
$month2, string
$year2)
|
|
Returns number of days between two given dates.
Parameters:
dateFormat [line 1342]
string dateFormat(
string
$day, string
$month, string
$year, string
$format)
|
|
Formats the date in the given format, much like strfmt(). This function is used to alleviate the problem with 32-bit numbers for dates pre 1970 or post 2038, as strfmt() has on most systems. Most of the formatting options are compatible. formatting options: %a abbreviated weekday name (Sun, Mon, Tue) %A full weekday name (Sunday, Monday, Tuesday) %b abbreviated month name (Jan, Feb, Mar) %B full month name (January, February, March) %d day of month (range 00 to 31) %e day of month, single digit (range 0 to 31) %E number of days since unspecified epoch (integer) (%E is useful for passing a date in a URL as an integer value. Then simply use daysToDate() to convert back to a date.) %j day of year (range 001 to 366) %m month as decimal number (range 1 to 12) %n newline character (\n) %t tab character (\t) %w weekday as decimal (0 = Sunday) %U week number of current year, first sunday as first week %y year as decimal (range 00 to 99) %Y year as decimal including century (range 0000 to 9999) %% literal '%'
Parameters:
dateNow [line 47]
string dateNow(
[string
$format = '%Y%m%d'])
|
|
Returns the current local date. NOTE: This function retrieves the local date using strftime(), which may or may not be 32-bit safe on your system.
Parameters:
dateSeason [line 1702]
float dateSeason(
string
$season, [string
$year = ''])
|
|
Determines julian date of the given season Adapted from previous work in Java by James Mark Hamilton, mhamilton@qwest.net
Parameters:
dateToDays [line 1204]
integer dateToDays(
string
$day, string
$month, string
$year)
|
|
Converts a date to number of days since a distant unspecified epoch.
Parameters:
dayOfWeek [line 188]
int dayOfWeek(
[string
$day = ''], [string
$month = ''], [string
$year = ''])
|
|
Returns day of week for given date, 0=Sunday
Parameters:
daysInMonth [line 813]
int daysInMonth(
[string
$month = ''], [string
$year = ''])
|
|
Find the number of days in the given month.
Parameters:
daysToDate [line 1239]
string daysToDate(
int
$days, [string
$format = '%Y%m%d'])
|
|
Converts number of days to a distant unspecified epoch.
Parameters:
defaultCentury [line 738]
string defaultCentury(
string
$year)
|
|
Sets century for 2 digit year. 51-99 is 19, else 20
Parameters:
endOfNextMonth [line 361]
string endOfNextMonth(
[string
$day = ''], [string
$month = ''], [string
$year = ''], [string
$format = '%Y%m%d'])
|
|
Returns date of the last day of next month of given date.
Parameters:
endOfPrevMonth [line 435]
string endOfPrevMonth(
[string
$day = ''], [string
$month = ''], [string
$year = ''], [string
$format = '%Y%m%d'])
|
|
Returns date of the last day of previous month for given date.
Parameters:
endOfWeek [line 970]
string endOfWeek(
[string
$day = ''], [string
$month = ''], [string
$year = ''], [string
$format = '%Y%m%d'])
|
|
Find the month day of the end of week for given date, using DATE_CALC_BEGIN_WEEKDAY. (can return weekday of following month.)
Parameters:
firstOfMonthWeekday [line 886]
int firstOfMonthWeekday(
[string
$month = ''], [string
$year = ''])
|
|
Find the day of the week for the first of the month of given date.
Parameters:
getCalendarMonth [line 1124]
array getCalendarMonth(
[string
$month = ''], [string
$year = ''], [string
$format = '%Y%m%d'])
|
|
Return a set of arrays to construct a calendar month for the given date.
Parameters:
getCalendarWeek [line 1085]
array getCalendarWeek(
[string
$day = ''], [string
$month = ''], [string
$year = ''], [string
$format = '%Y%m%d'])
|
|
Return an array with days in week
Parameters:
getCalendarYear [line 1175]
array getCalendarYear(
[string
$year = ''], [string
$format = '%Y%m%d'])
|
|
Return a set of arrays to construct a calendar year for the given date.
Parameters:
getDay [line 1450]
Returns the current local day in format DD
getMonth [line 1437]
Returns the current local month in format MM
getMonthAbbrname [line 1492]
string getMonthAbbrname(
string
$month, [int
$length = 3])
|
|
Returns the abbreviated month name for the given month
Parameters:
getMonthFromFullName [line 1571]
integer getMonthFromFullName(
string
$month)
|
|
Returns the numeric month from the month name or an abreviation Both August and Aug would return 8. Month name is case insensitive.
Parameters:
getMonthFullname [line 1465]
string getMonthFullname(
string
$month)
|
|
Returns the full month name for the given month
Parameters:
getMonthNames [line 1594]
Returns an array of month names Used to take advantage of the setlocale function to return language specific month names. XXX cache values to some global array to avoid preformace hits when called more than once.
getWeekdayAbbrname [line 1547]
string getWeekdayAbbrname(
[string
$day = ''], [string
$month = ''], [string
$year = ''], [int
$length = 3])
|
|
Returns the abbreviated weekday name for the given date
Parameters:
getWeekdayFullname [line 1515]
string getWeekdayFullname(
[string
$day = ''], [string
$month = ''], [string
$year = ''])
|
|
Returns the full weekday name for the given date
Parameters:
getWeekDays [line 1612]
Returns an array of week days Used to take advantage of the setlocale function to return language specific week days XXX cache values to some global array to avoid preformace hits when called more than once.
getYear [line 1424]
Returns the current local year in format CCYY
gregorianToISO [line 1635]
string gregorianToISO(
string
$day, string
$month, string
$year)
|
|
Converts from Gregorian Year-Month-Day to ISO YearNumber-WeekNumber-WeekDay Uses ISO 8601 definitions. Algorithm from Rick McCarty, 1999 at http://personal.ecu.edu/mccartyr/ISOwdALG.txt
Parameters:
isFutureDate [line 122]
boolean isFutureDate(
string
$day, string
$month, string
$year)
|
|
Determines if given date is a future date from now.
Parameters:
isLeapYear [line 87]
boolean isLeapYear(
[string
$year = ''])
|
|
Returns true for a leap year, else false
Parameters:
isPastDate [line 155]
boolean isPastDate(
string
$day, string
$month, string
$year)
|
|
Determines if given date is a past date from now.
Parameters:
isValidDate [line 65]
boolean isValidDate(
string
$day, string
$month, string
$year)
|
|
Returns true for valid date, false for invalid date.
Parameters:
julianDate [line 259]
int julianDate(
[string
$day = ''], [string
$month = ''], [string
$year = ''])
|
|
Returns number of days since 31 December of year before given date.
Parameters:
nextDay [line 680]
string nextDay(
[string
$day = ''], [string
$month = ''], [string
$year = ''], [string
$format = '%Y%m%d'])
|
|
Returns date of day after given date.
Parameters:
nextDayOfWeek [line 553]
string nextDayOfWeek(
int
$dow, [string
$day = ''], [string
$month = ''], [string
$year = ''], [boolean
$format = '%Y%m%d'], [string
$onOrAfter = false])
|
|
Returns date of the next specific day of the week from the given date.
Parameters:
nextDayOfWeekOnOrAfter [line 642]
string nextDayOfWeekOnOrAfter(
int
$dow, [string
$day = ''], [string
$month = ''], [string
$year = ''], [string
$format = '%Y%m%d'])
|
|
Returns date of the next specific day of the week on or after the given date.
Parameters:
nextWeekday [line 473]
string nextWeekday(
[string
$day = ''], [string
$month = ''], [string
$year = ''], [string
$format = '%Y%m%d'])
|
|
Returns date of the next weekday of given date, skipping from Friday to Monday.
Parameters:
NWeekdayOfMonth [line 1285]
string NWeekdayOfMonth(
string
$occurance, string
$dayOfWeek, string
$month, string
$year, [string
$format = '%Y%m%d'])
|
|
Calculates the date of the Nth weekday of the month, such as the second Saturday of January 2000.
Parameters:
prevDay [line 710]
string prevDay(
[string
$day = ''], [string
$month = ''], [string
$year = ''], [string
$format = '%Y%m%d'])
|
|
Returns date of day before given date.
Parameters:
prevDayOfWeek [line 598]
string prevDayOfWeek(
int
$dow, [string
$day = ''], [string
$month = ''], [string
$year = ''], [boolean
$format = '%Y%m%d'], [string
$onOrBefore = false])
|
|
Returns date of the previous specific day of the week from the given date.
Parameters:
prevDayOfWeekOnOrBefore [line 662]
string prevDayOfWeekOnOrBefore(
int
$dow, [string
$day = ''], [string
$month = ''], [string
$year = ''], [string
$format = '%Y%m%d'])
|
|
Returns date of the previous specific day of the week on or before the given date.
Parameters:
prevWeekday [line 512]
string prevWeekday(
[string
$day = ''], [string
$month = ''], [string
$year = ''], [string
$format = '%Y%m%d'])
|
|
Returns date of the previous weekday, skipping from Monday to Friday.
Parameters:
quarterOfYear [line 294]
int quarterOfYear(
[string
$day = ''], [string
$month = ''], [string
$year = ''])
|
|
Returns quarter of the year for given date
Parameters:
weekOfYear [line 230]
integer weekOfYear(
[string
$day = ''], [string
$month = ''], [string
$year = ''])
|
|
Returns week of the year, first Sunday is first day of first week
Parameters:
weeksInMonth [line 852]
int weeksInMonth(
[string
$month = ''], [string
$year = ''])
|
|
Returns the number of rows on a calendar month. Useful for determining the number of rows when displaying a typical month calendar.
Parameters:
Documentation generated on Sat, 1 May 2004 03:34:27 +0200 by phpDocumentor 1.2.3. PEAR Logo Copyright © PHP Group 2004.
|
|