You are here

public function DateObject::addGranularity in Date 7.3

Same name and namespace in other branches
  1. 7 date_api/date_api.module \DateObject::addGranularity()
  2. 7.2 date_api/date_api.module \DateObject::addGranularity()

Adds a granularity entry to the array.

Parameters

string $g: A single date part.

5 calls to DateObject::addGranularity()
DateObject::arrayErrors in date_api/date_api.module
Finds possible errors in an array of date part values.
DateObject::parse in date_api/date_api.module
Converts a date string into a date object.
DateObject::setGranularityFromTime in date_api/date_api.module
Determines the granularity of a date based on the constructor's arguments.
DateObject::setTimezone in date_api/date_api.module
Sets the time zone for the current date.
DateObject::__construct in date_api/date_api.module
Constructs a date object.

File

date_api/date_api.module, line 417
This module will make the date API available to other modules.

Class

DateObject
Extend PHP DateTime class.

Code

public function addGranularity($g) {
  $this->granularity[] = $g;
  $this->granularity = array_unique($this->granularity);
}