public function DateObject::toArray in Date 7.3
Same name and namespace in other branches
- 7 date_api/date_api.module \DateObject::toArray()
- 7.2 date_api/date_api.module \DateObject::toArray()
Returns all standard date parts in an array.
Will return '' for parts in which it lacks granularity.
Parameters
bool $force: Whether or not to limit the granularity. Defaults to FALSE.
Return value
array An array of formatted date part values, keyed by date parts.
1 call to DateObject::toArray()
- DateObject::setTimezone in date_api/
date_api.module - Sets the time zone for the current date.
File
- date_api/
date_api.module, line 813 - This module will make the date API available to other modules.
Class
- DateObject
- Extend PHP DateTime class.
Code
public function toArray($force = FALSE) {
return array(
'year' => $this
->format('Y', $force),
'month' => $this
->format('n', $force),
'day' => $this
->format('j', $force),
'hour' => intval($this
->format('H', $force)),
'minute' => intval($this
->format('i', $force)),
'second' => intval($this
->format('s', $force)),
'timezone' => $this
->format('e', $force),
);
}