function date_sql_handler::arg_granularity in Date 7
Same name and namespace in other branches
- 5.2 date_api_sql.inc \date_sql_handler::arg_granularity()
- 6.2 date_api_sql.inc \date_sql_handler::arg_granularity()
- 7.3 date_api/date_api_sql.inc \date_sql_handler::arg_granularity()
- 7.2 date_api/date_api_sql.inc \date_sql_handler::arg_granularity()
Use the parsed values from the ISO argument to determine the granularity of this period.
File
- date_api/
date_api_sql.inc, line 807 - SQL helper for Date API.
Class
- date_sql_handler
- A class to manipulate date SQL.
Code
function arg_granularity($arg) {
$granularity = '';
$parts = $this
->arg_parts($arg);
$date = !empty($parts[0]['date']) ? $parts[0]['date'] : (!empty($parts[1]['date']) ? $parts[1]['date'] : array());
foreach ($date as $key => $part) {
$granularity = $key;
}
return $granularity;
}