function date_array in Date 6
Same name and namespace in other branches
- 5.2 date_api.module \date_array()
- 6.2 date_api.module \date_array()
Create an array of values from a date object. Structured like the results of getdate() but not limited to the 32-bit signed range.
Parameters
object $obj:
Return value
array
2 calls to date_array()
- date_convert in ./
date_api.module - Date conversion helper function.
- date_sql_handler::arg_parts in ./
date_api_sql.inc - Parse date parts from an ISO date argument.
File
- ./
date_api.module, line 1011 - 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_array($obj) {
$year = intval(date_format($obj, 'Y'));
$dow = date_format($obj, 'w');
$days = date_week_days();
return array(
'second' => (int) date_format($obj, 's'),
'minute' => (int) date_format($obj, 'i'),
'hour' => date_format($obj, 'G'),
'day' => date_format($obj, 'j'),
'wday' => $dow,
'month' => date_format($obj, 'n'),
'year' => date_format($obj, 'Y'),
'yday' => date_format($obj, 'z'),
'weekday' => $days[$dow],
'month_name' => date_format($obj, 'F'),
0 => date_format($obj, 'U'),
);
}