You are here

protected function FeedsDateTime::toArray in Feeds 7

Same name and namespace in other branches
  1. 6 plugins/FeedsParser.inc \FeedsDateTime::toArray()
  2. 7.2 plugins/FeedsParser.inc \FeedsDateTime::toArray()

Helper to return all standard date parts in an array.

1 call to FeedsDateTime::toArray()
FeedsDateTime::setTimezone in plugins/FeedsParser.inc
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

plugins/FeedsParser.inc, line 605

Class

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

Code

protected function toArray() {
  return array(
    'year' => $this
      ->format('Y'),
    'month' => $this
      ->format('m'),
    'day' => $this
      ->format('d'),
    'hour' => $this
      ->format('H'),
    'minute' => $this
      ->format('i'),
    'second' => $this
      ->format('s'),
    'zone' => $this
      ->format('e'),
  );
}