You are here

public function DatexObject::xtoArray in Datex 7

Same name and namespace in other branches
  1. 7.2 datex_api/datex_api.class.inc \DatexObject::xtoArray()

Same as DatexObject toArray but in Gregorian format.

Return value

array An array of date granuls.

File

datex_api/datex_api_classes.inc, line 965
API and helper functions used by other datex modules.

Class

DatexObject
This class is Jalali equivilant of php DateTime. It also has some functionallity from object defiend in Drupal's date module DateObject.

Code

public function xtoArray() {
  return array(
    'year' => $this->dateobj
      ->format('Y'),
    'month' => $this->dateobj
      ->format('n'),
    'day' => $this->dateobj
      ->format('j'),
    'hour' => intval($this->dateobj
      ->format('H')),
    'minute' => intval($this->dateobj
      ->format('i')),
    'second' => intval($this->dateobj
      ->format('s')),
    'timezone' => $this->dateobj
      ->format('e'),
  );
}