You are here

public function DateObject::format in Date 7.2

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

Returns date formatted according to given format.

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

@todo Add translation into this so translated names will be provided.

Parameters

string $format: A date format string.

bool $force: Whether or not to limit the granularity. Defaults to FALSE.

Return value

string|bool Returns the formatted date string on success or FALSE on failure.

3 calls to DateObject::format()
DateObject::toArray in date_api/date_api.module
Returns all standard date parts in an array.
DateObject::__sleep in date_api/date_api.module
Prepares the object during serialization.
DateObject::__toString in date_api/date_api.module
Returns the date object as a string.

File

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

Class

DateObject
Extend PHP DateTime class.

Code

public function format($format, $force = FALSE) {
  return parent::format($force ? $format : date_limit_format($format, $this->granularity));
}