Class iCalDate

Description

A Class for handling dates in iCalendar format. We do make the simplifying assumption that all date handling in here is normalised to GMT. One day we might provide some functions to do that, but for now it is done externally.

Located in /inc/RRule.php (line 21)


	
			
Method Summary
 iCalDate iCalDate ( $input)
 void AddDays ( $dd)
 void AddDuration ( $duration)
 void AddMonths ( $mo)
 array &ApplyBySetPos (string $bysplist, string $set)
 string DateDifference (date $from)
 void DaysInMonth ([ $mo = false], [ $yy = false])
 array GetMonthByDay (string $byday)
 array GetMonthByMonthDay (string $bymonthday)
 array GetWeekByDay (string $byday, [string $increasing = false])
 boolean GreaterThan (string $lesser)
 boolean LessThan (string $greater)
 array &MonthDays (string $dow_first, string $days_in_month, string $dayspec)
 void Render ([ $fmt = 'Y-m-d H:i:s'])
 void SetEpochDate ( $input)
 void SetGMTDate ( $input)
 void SetLocalDate ( $input)
 void SetMonthDay ( $dd)
 void SetWeekStart (string $weekstart)
 boolean TestByMonth (string $monthlist)
 void _EpochFromParts ()
 void _PartsFromText ()
 void _TextFromEpoch ()
Methods
Constructor iCalDate (line 50)

The constructor takes either an iCalendar date, a text string formatted as an iCalendar date, or epoch seconds.

iCalDate iCalDate ( $input)
  • $input
AddDays (line 256)

Add some integer number of days to a date

void AddDays ( $dd)
  • $dd
AddDuration (line 284)

Add duration

void AddDuration ( $duration)
  • $duration
AddMonths (line 228)

Add some number of months to a date

void AddMonths ( $mo)
  • $mo
ApplyBySetPos (line 553)

Given set position descriptions like '1', '3', '11', '-3' or '-1' and a set, return the subset matching the list of set positions.

  • return: The subset which matches.
array &ApplyBySetPos (string $bysplist, string $set)
  • string $bysplist: The list of set positions.
  • string $set: The set of days that we will apply the positions to.
DateDifference (line 321)

Produce an iCalendar format DURATION for the difference between this an another iCalDate

  • return: The date difference, as an iCalendar duration format
string DateDifference (date $from)
  • date $from: The start of the period
DaysInMonth (line 179)

No of days in a month 1(Jan) - 12(Dec)

void DaysInMonth ([ $mo = false], [ $yy = false])
  • $mo
  • $yy
GetMonthByDay (line 404)

Applies any BYDAY to the month to return a set of days

  • return: An array of the day numbers for the month which meet the rule.
array GetMonthByDay (string $byday)
  • string $byday: The BYDAY rule
GetMonthByMonthDay (line 425)

Applies any BYMONTHDAY to the month to return a set of days

  • return: An array of the day numbers for the month which meet the rule.
array GetMonthByMonthDay (string $bymonthday)
  • string $bymonthday: The BYMONTHDAY rule
GetWeekByDay (line 445)

Applies any BYDAY to the week to return a set of days

  • return: An array of the day numbers for the week which meet the rule.
array GetWeekByDay (string $byday, [string $increasing = false])
  • string $byday: The BYDAY rule
  • string $increasing: When we are moving by months, we want any day of the week, but when by day we only want to increase. Default false.
GreaterThan (line 468)

Test if $this is greater than the date parameter

  • return: True if $this > $lesser
boolean GreaterThan (string $lesser)
  • string $lesser: The other date, as a local time string
LessThan (line 483)

Test if $this is less than the date parameter

  • return: True if $this < $greater
boolean LessThan (string $greater)
  • string $greater: The other date, as a local time string
MonthDays (line 502)

Given a MonthDays string like "1MO", "-2WE" return an integer day of the month.

  • return: An array of the day numbers for the month which meet the rule.
array &MonthDays (string $dow_first, string $days_in_month, string $dayspec)
  • string $dow_first: The day of week of the first of the month.
  • string $days_in_month: The number of days in the month.
  • string $dayspec: The specification for a month day (or days) which we parse.
Render (line 171)

Set the day of week used for calculation of week starts

void Render ([ $fmt = 'Y-m-d H:i:s'])
  • $fmt
SetEpochDate (line 103)

Set the date from an epoch

void SetEpochDate ( $input)
  • $input
SetGMTDate (line 83)

Set the date from a text string

void SetGMTDate ( $input)
  • $input
SetLocalDate (line 93)

Set the date from a text string

void SetLocalDate ( $input)
  • $input
SetMonthDay (line 216)

Set the day in the month to what we have been given

void SetMonthDay ( $dd)
  • $dd
SetWeekStart (line 162)

Set the day of week used for calculation of week starts

void SetWeekStart (string $weekstart)
  • string $weekstart: The day of the week which is the first business day.
TestByMonth (line 392)

Test to see if our _mo matches something in the list of months we have received.

  • return: Whether this date falls within one of those months.
boolean TestByMonth (string $monthlist)
  • string $monthlist: A comma-separated list of months.
_EpochFromParts (line 151)

Given a local text date, convert it to an epoch

void _EpochFromParts ()
_GMTEpochFromParts (line 142)

Given a GMT text date, convert it to an epoch

void _GMTEpochFromParts ()
_GMTTextFromEpoch (line 121)

Given a GMT epoch date, convert it to text

void _GMTTextFromEpoch ()
_PartsFromText (line 129)

Given a text date, convert it to parts

void _PartsFromText ()
_TextFromEpoch (line 113)

Given an epoch date, convert it to text

void _TextFromEpoch ()

Documentation generated on Tue, 18 Nov 2008 18:33:32 +1300 by phpDocumentor 1.3.2