You are here

public function DateObject::format in Date 7

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

Overrides base format function, formats this date according to its available granularity, unless $force'ed not to limit to granularity.

@TODO Incorporate translation into this so translated names will be provided.

3 calls to DateObject::format()
DateObject::toArray in date_api/date_api.module
Helper to return all standard date parts in an array. Will return '' for parts in which it lacks granularity.
DateObject::__sleep in date_api/date_api.module
Helper function to prepare the object during serialization.
DateObject::__toString in date_api/date_api.module

File

date_api/date_api.module, line 237
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 format($format, $force = FALSE) {
  return parent::format($force ? $format : date_limit_format($format, $this->granularity));
}