You are here

function date_iso_array in Date 6

Same name and namespace in other branches
  1. 5.2 date_api.module \date_iso_array()
  2. 6.2 date_api.module \date_iso_array()

Create an array of date parts from an ISO date.

2 calls to date_iso_array()
date_convert in ./date_api.module
Date conversion helper function.
date_fuzzy_datetime in ./date_api.module
Create valid datetime value from incomplete ISO dates or arrays.

File

./date_api.module, line 992
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.

Code

function date_iso_array($date) {
  preg_match(DATE_REGEX_LOOSE, $date, $regs);
  return array(
    'year' => intval($regs[1]),
    'month' => intval($regs[2]),
    'day' => intval($regs[3]),
    'hour' => intval($regs[5]),
    'minute' => intval($regs[6]),
    'second' => intval($regs[7]),
  );
}