You are here

public function DateObject::addGranularity in Date 7

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

Safely adds a granularity entry to the array.

3 calls to DateObject::addGranularity()
DateObject::parse in date_api/date_api.module
DateObject::setGranularityFromTime in date_api/date_api.module
Protected function to find the granularity given by the arguments to the constructor.
DateObject::setTimezone in date_api/date_api.module
Overrides default DateTime function. Only changes output values if actually had time granularity. This should be used as a "converter" for output, to switch tzs.

File

date_api/date_api.module, line 244
This module will make the date API available to other modules. Designed to provide a light but flexible assortment of functions and constants, with more functionality in additional files that are not loaded unless other modules specifically include them.

Class

DateObject
Extend PHP DateTime class with granularity handling, merge functionality and slightly more flexible initialization parameters.

Code

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