Class Horde_Date

Description

Horde Date wrapper/logic class, including some calculation functions.

$Horde: framework/Date/Date.php,v 1.8.10.21 2010-10-19 20:20:13 jan Exp $

Located in /Date/Date.php (line 38)


	
			
Variable Summary
 integer $hour
 integer $mday
 integer $min
 integer $month
 integer $sec
 integer $year
Method Summary
 static void daysInMonth ( $month,  $year)
 static void isLeapYear ( $year)
 static integer weeksInYear (integer $year)
 static void _mktime ( $hr,  $min,  $sec, [ $mon = false], [ $day = false], [ $year = false], [ $is_dst = false], [ $is_gmt = false])
 Horde_Date Horde_Date ([ $date = null])
 integer compareDate (mixed $date)
 integer compareDateTime (mixed $date)
 integer compareTime (mixed $date)
 void correct ([integer $mask = HORDE_DATE_MASK_ALLPARTS])
 string cTime ()
 integer datestamp ()
 integer dayOfWeek ()
 integer dayOfYear ()
 void dump ([ $prefix = ''])
 integer firstDayOfWeek (integer $week, integer $year)
 string format (string $format)
 string iso8601DateTime ()
 boolean isValid ()
 string rfc2822DateTime ()
 string rfc3339DateTime ()
 void setNthWeekday (integer $weekday, [integer $nth = 1])
 string sqlDateTime ()
 string strftime ( $format)
 integer timestamp ()
 string tzOffset ([boolean $colon = true])
 integer weekOfMonth ()
 integer weekOfYear ()
 void _setTimeZone ()
 string _strftime ( $format)
Variables
integer $hour = 0 (line 66)

Hour

integer $mday (line 59)

Day

integer $min = 0 (line 73)

Minute

integer $month (line 52)

Month

integer $sec = 0 (line 80)

Second

integer $year (line 45)

Year

string $_supportedSpecs = '%CdDeHImMnRStTyY' (line 87)

Internally supported strftime() specifiers.

Methods
static daysInMonth (line 185)
static void daysInMonth ( $month,  $year)
  • $month
  • $year
static isLeapYear (line 152)
static void isLeapYear ( $year)
  • $year
static weeksInYear (line 272)

Return the number of weeks in the given year (52 or 53).

  • return: The number of weeks in $year.
static integer weeksInYear (integer $year)
  • integer $year: The year to count the number of weeks in.
static _mktime (line 686)

mktime() implementation that supports dates outside of 1970-2038, from http://phplens.com/phpeverywhere/adodb_date_library.

  • TODO:

    remove in Horde 4

    This does NOT work with pre-1970 daylight saving times.

static void _mktime ( $hr,  $min,  $sec, [ $mon = false], [ $day = false], [ $year = false], [ $is_dst = false], [ $is_gmt = false])
  • $hr
  • $min
  • $sec
  • $mon
  • $day
  • $year
  • $is_dst
  • $is_gmt
Constructor Horde_Date (line 102)

Build a new date object. If $date contains date parts, use them to initialize the object.

Recognized formats:

  • arrays with keys 'year', 'month', 'mday', 'day' (since Horde 3.2), 'hour', 'min', 'minute' (since Horde 3.2), 'sec'
  • objects with properties 'year', 'month', 'mday', 'hour', 'min', 'sec'
  • yyyy-mm-dd hh:mm:ss (since Horde 3.1)
  • yyyymmddhhmmss (since Horde 3.1)
  • yyyymmddThhmmssZ (since Horde 3.1.4)
  • unix timestamps

Horde_Date Horde_Date ([ $date = null])
  • $date
compareDate (line 403)

Compare this date to another date object to see which one is greater (later). Assumes that the dates are in the same timezone.

  • return: == 0 if the dates are equal >= 1 if this date is greater (later) <= -1 if the other date is greater (later)
integer compareDate (mixed $date)
  • mixed $date: The date to compare to.
compareDateTime (line 457)

Compare this to another date object, including times, to see which one is greater (later). Assumes that the dates are in the same timezone.

  • return: == 0 if the dates are equal >= 1 if this date is greater (later) <= -1 if the other date is greater (later)
integer compareDateTime (mixed $date)
  • mixed $date: The date to compare to.
compareTime (line 430)

Compare this to another date object by time, to see which one is greater (later). Assumes that the dates are in the same timezone.

  • return: == 0 if the dates are equal >= 1 if this date is greater (later) <= -1 if the other date is greater (later)
integer compareTime (mixed $date)
  • mixed $date: The date to compare to.
correct (line 332)

Correct any over- or underflows in any of the date's members.

void correct ([integer $mask = HORDE_DATE_MASK_ALLPARTS])
  • integer $mask: We may not want to correct some overflows.
cTime (line 598)

Format time to standard 'ctime' format.

  • return: Date and time.
string cTime ()
datestamp (line 512)

Return the unix timestamp representation of this date, 12:00am.

  • return: A unix timestamp.
integer datestamp ()
dayOfWeek (line 206)

Return the day of the week (0 = Sunday, 6 = Saturday) of this object's date.

  • return: The day of the week.
integer dayOfWeek ()
dayOfYear (line 230)

Returns the day number of the year (1 to 365/366).

  • return: The day of the year.
integer dayOfYear ()
dump (line 309)
void dump ([ $prefix = ''])
  • $prefix
firstDayOfWeek (line 172)

Returns the day of the year (1-366) that corresponds to the first day of the given week.

TODO: with PHP 5.1+, see http://derickrethans.nl/calculating_start_and_end_dates_of_a_week.php

  • return: The day of the year of the first day of the given week.
integer firstDayOfWeek (integer $week, integer $year)
  • integer $week: The week of the year to find the first day of.
  • integer $year: The year to calculate for.
format (line 535)

Format time using the specifiers available in date() or in the DateTime class' format() method.

  • return: Formatted time.
  • since: Horde 3.3
string format (string $format)
  • string $format
iso8601DateTime (line 553)

Format time in ISO-8601 format. Works correctly since Horde 3.2.

  • return: Date and time in ISO-8601 format.
string iso8601DateTime ()
isValid (line 319)

Is the date currently represented by this object a valid date?

  • return: Validity, counting leap years, etc.
boolean isValid ()
rfc2822DateTime (line 563)

Format time in RFC 2822 format.

  • return: Date and time in RFC 2822 format.
string rfc2822DateTime ()
rfc3339DateTime (line 576)

Format time in RFC 3339 format.

  • return: Date and time in RFC 3339 format. The seconds part has been added with Horde 3.2.
  • since: Horde 3.1
string rfc3339DateTime ()
setNthWeekday (line 289)

Set the date of this object to the $nth weekday of $weekday.

void setNthWeekday (integer $weekday, [integer $nth = 1])
  • integer $weekday: The day of the week (0 = Sunday, etc).
  • integer $nth: The $nth $weekday to set to (defaults to 1).
sqlDateTime (line 588)

Format time in the format we use for SQL queries.

  • return: Date and time in SQL format.
  • since: Horde 3.3.6
string sqlDateTime ()
strftime (line 610)

Format date and time using strftime() format.

  • return: formatted date and time.
  • since: Horde 3.1
string strftime ( $format)
  • $format
timestamp (line 498)

Return the unix timestamp representation of this date.

  • return: A unix timestamp.
integer timestamp ()
tzOffset (line 477)

Get the time offset for local time zone.

  • return: Timezone offset as a string in the format +HH:MM.
string tzOffset ([boolean $colon = true])
  • boolean $colon: Place a colon between hours and minutes?
weekOfMonth (line 248)

Returns the week of the month.

  • return: The week number.
  • since: Horde 3.2
integer weekOfMonth ()
weekOfYear (line 258)

Returns the week of the year, first Monday is first day of first week.

  • return: The week number.
integer weekOfYear ()
_setTimeZone (line 786)

Sets the current timezone, if available.

void _setTimeZone ()
_strftime (line 624)

Format date and time using a limited set of the strftime() format.

  • return: formatted date and time.
string _strftime ( $format)
  • $format

Documentation generated on Sun, 30 Jan 2011 05:16:38 +0000 by phpDocumentor 1.4.3