function date_iso_array in Date 5.2
Same name and namespace in other branches
- 6.2 date_api.module \date_iso_array()
- 6 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 1107 - 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' => isset($regs[1]) ? intval($regs[1]) : '',
'month' => isset($regs[2]) ? intval($regs[2]) : '',
'day' => isset($regs[3]) ? intval($regs[3]) : '',
'hour' => isset($regs[5]) ? intval($regs[5]) : '',
'minute' => isset($regs[6]) ? intval($regs[6]) : '',
'second' => isset($regs[7]) ? intval($regs[7]) : '',
);
}