# Date Class Reference
[Widely used base classes and interfaces]

Date's container and utilities. More...

Inheritance diagram for Date:
[legend]

List of all members.

## Public Member Functions

| __construct ($date)
| toStamp ()
| toDate ($delimiter= '-')
| getYear ()
| getMonth ()
| getDay ()
| getWeek ()
| getWeekDay ()
| spawn ($modification=null)
| modify ($string)
| getDayStartStamp ()
| getDayEndStamp ()
| getFirstDayOfWeek ($weekStart=Date::WEEKDAY_MONDAY)
| getLastDayOfWeek ($weekStart=Date::WEEKDAY_MONDAY)
| toString ()
| toDialectString (Dialect $dialect)
| toIsoString ()
| ISO 8601 date string.
| toTimestamp ()

## Static Public Member Functions

static | create ($date)
static | today ($delimiter= '-')
static | makeToday ()
static | makeFromWeek ($weekNumber, $year=null)
static | dayDifference (Date $left, Date $right)
static | compare (Date $left, Date $right)
static | getWeekCountInYear ($year)

## Public Attributes

const | WEEKDAY_MONDAY = 1
const | WEEKDAY_TUESDAY = 2
const | WEEKDAY_WEDNESDAY = 3
const | WEEKDAY_THURSDAY = 4
const | WEEKDAY_FRIDAY = 5
const | WEEKDAY_SATURDAY = 6
const | WEEKDAY_SUNDAY = 0

## Protected Member Functions

| import ($string)
| stringImport ($string)
| buildInteger ()

## Static Protected Member Functions

static | getFormat ()

## Protected Attributes

| $string = null
| $int = null
| $year = null
| $month = null
| $day = null

## Detailed Description

Date's container and utilities.

See also:
  DateRange

Definition at line 21 of file Date.class.php.

## Constructor & Destructor Documentation

Date::__construct | ( | $ | date | ) |

Definition at line 124 of file Date.class.php.

References buildInteger(), getFormat(), and stringImport().

Here is the call graph for this function:

## Member Function Documentation

Date::buildInteger | ( |  | ) | `[protected]`

Reimplemented in Timestamp.

Definition at line 330 of file Date.class.php.

Referenced by __construct().

static Date::compare | ( | Date $ | left,
|  | Date $ | right |
| ) |  |  | `[static]`

Definition at line 111 of file Date.class.php.

Referenced by RussianTextUtils::getDateAsText(), DateRange::safeSetEnd(), and DateRange::safeSetStart().

static Date::create | ( | $ | date | ) | `[static]`

Returns:
  Date

Reimplemented in Timestamp, and CalendarDay.

Definition at line 41 of file Date.class.php.

Referenced by IntervalUnit::countInRange(), DateUtils::makeDatesListByRange(), and toTimestamp().

static Date::dayDifference | ( | Date $ | left,
|  | Date $ | right |
| ) |  |  | `[static]`

Definition at line 96 of file Date.class.php.

References getDay(), getMonth(), and getYear().

Referenced by IntervalUnit::countInRange(), and IntervalUnit::truncate().

Here is the call graph for this function:

Date::getDay | ( |  | ) |

Definition at line 166 of file Date.class.php.

Referenced by dayDifference(), DateUtils::getAgeByBirthDate(), RussianTextUtils::getHumanDay(), and IntervalUnit::truncate().

Date::getDayEndStamp | ( |  | ) |

Definition at line 231 of file Date.class.php.

Date::getDayStartStamp | ( |  | ) |

Reimplemented in Timestamp.

Definition at line 220 of file Date.class.php.

Date::getFirstDayOfWeek | ( | $ | weekStart = `Date::WEEKDAY_MONDAY` | ) |

Returns:
  Date

Definition at line 245 of file Date.class.php.

References getWeekDay(), and spawn().

Here is the call graph for this function:

static Date::getFormat | ( |  | ) | `[static, protected]`

Reimplemented in Timestamp.

Definition at line 289 of file Date.class.php.

Referenced by __construct(), modify(), and stringImport().

Date::getLastDayOfWeek | ( | $ | weekStart = `Date::WEEKDAY_MONDAY` | ) |

Returns:
  Date

Definition at line 255 of file Date.class.php.

References getWeekDay(), and spawn().

Here is the call graph for this function:

Date::getMonth | ( |  | ) |

Definition at line 161 of file Date.class.php.

Referenced by CalendarMonthWeekly::__construct(), dayDifference(), DateUtils::getAgeByBirthDate(), RussianTextUtils::getHumanDay(), DateUtils::makeFirstDayOfMonth(), DateUtils::makeLastDayOfMonth(), and IntervalUnit::truncate().

Date::getWeek | ( |  | ) |

Definition at line 171 of file Date.class.php.

static Date::getWeekCountInYear | ( | $ | year | ) | `[static]`

Definition at line 119 of file Date.class.php.

References $year.

Referenced by makeFromWeek().

Date::getWeekDay | ( |  | ) |

Definition at line 176 of file Date.class.php.

Referenced by getFirstDayOfWeek(), and getLastDayOfWeek().

Date::getYear | ( |  | ) |

Definition at line 156 of file Date.class.php.

Referenced by CalendarMonthWeekly::__construct(), dayDifference(), DateUtils::getAgeByBirthDate(), DateUtils::makeFirstDayOfMonth(), DateUtils::makeLastDayOfMonth(), and IntervalUnit::truncate().

Date::import | ( | $ | string | ) | `[protected]`

Reimplemented in Timestamp.

Definition at line 294 of file Date.class.php.

References $string.

static Date::makeFromWeek | ( | $ | weekNumber,
|  | $ | year = `null` |
| ) |  |  | `[static]`

Returns:
  Date

See also:
  http://www.faqs.org/rfcs/rfc3339.html
  http://www.cl.cam.ac.uk/~mgk25/iso-time.html

Definition at line 64 of file Date.class.php.

References $year, getWeekCountInYear(), and Assert::isTrue().

Here is the call graph for this function:

static Date::makeToday | ( |  | ) | `[static]`

Returns:
  Date

Reimplemented in Timestamp.

Definition at line 54 of file Date.class.php.

References today().

Referenced by DateUtils::getAgeByBirthDate(), and RussianTextUtils::getHumanDay().

Here is the call graph for this function:

Date::modify | ( | $ | string | ) |

Exceptions:

  | WrongArgumentException |

Returns:
  Date

Definition at line 198 of file Date.class.php.

References $string, and getFormat().

Referenced by DateRange::split().

Here is the call graph for this function:

Date::spawn | ( | $ | modification = `null` | ) |

Returns:
  Date

Definition at line 184 of file Date.class.php.

Referenced by getFirstDayOfWeek(), getLastDayOfWeek(), and IntervalUnit::truncate().

Date::stringImport | ( | $ | string | ) | `[protected]`

Reimplemented in Timestamp.

Definition at line 316 of file Date.class.php.

References $string, and getFormat().

Referenced by __construct().

Here is the call graph for this function:

Date::toDate | ( | $ | delimiter = `'-'` | ) |

Definition at line 146 of file Date.class.php.

Referenced by CalendarWeek::addDay(), RussianTextUtils::getHumanDay(), CalendarMonthWeekly::setSelected(), Timestamp::toDateTime(), and IntervalUnit::truncate().

static Date::today | ( | $ | delimiter = `'-'` | ) | `[static]`

Definition at line 46 of file Date.class.php.

Referenced by Timestamp::makeToday(), and makeToday().

Date::toDialectString | ( | Dialect $ | dialect | ) |

Implements DialectString.

Definition at line 267 of file Date.class.php.

References toString().

Here is the call graph for this function:

Date::toIsoString | ( |  | ) |

ISO 8601 date string.

Definition at line 276 of file Date.class.php.

References toString().

Here is the call graph for this function:

Date::toStamp | ( |  | ) |

Definition at line 141 of file Date.class.php.

Referenced by CalendarMonthWeekly::__construct(), DateUtils::alignToSeconds(), PrimitiveDate::checkRanges(), RussianTextUtils::getDateAsText(), toTimestamp(), and IntervalUnit::truncate().

Date::toString | ( |  | ) |

Definition at line 262 of file Date.class.php.

Referenced by toDialectString(), and toIsoString().

Date::toTimestamp | ( |  | ) |

Returns:
  Timestamp

Reimplemented in Timestamp.

Definition at line 284 of file Date.class.php.

References create(), and toStamp().

Referenced by IntervalUnit::truncate().

Here is the call graph for this function:

## Member Data Documentation

Date::$day = null`[protected]`

Definition at line 36 of file Date.class.php.

Date::$int = null`[protected]`

Definition at line 32 of file Date.class.php.

Date::$month = null`[protected]`

Definition at line 35 of file Date.class.php.

Date::$string = null`[protected]`

Definition at line 31 of file Date.class.php.

Referenced by Timestamp::import(), import(), modify(), Timestamp::stringImport(), and stringImport().

Date::$year = null`[protected]`

Definition at line 34 of file Date.class.php.

Referenced by getWeekCountInYear(), and makeFromWeek().

const Date::WEEKDAY_FRIDAY = 5

Definition at line 27 of file Date.class.php.

const Date::WEEKDAY_MONDAY = 1

Definition at line 23 of file Date.class.php.

const Date::WEEKDAY_SATURDAY = 6

Definition at line 28 of file Date.class.php.

const Date::WEEKDAY_SUNDAY = 0

Definition at line 29 of file Date.class.php.

const Date::WEEKDAY_THURSDAY = 4

Definition at line 26 of file Date.class.php.

const Date::WEEKDAY_TUESDAY = 2

Definition at line 24 of file Date.class.php.

const Date::WEEKDAY_WEDNESDAY = 3

Definition at line 25 of file Date.class.php.

The documentation for this class was generated from the following file:

- core/Base/Date.class.php