1 date_sql_handler.inc | date_sql_handler::part_info($op = NULL, $part = NULL) |
Part information.
Parameters
string $op: 'min', 'max', 'format', 'sep', 'empty_now', 'empty_min', 'empty_max' . Returns all info if empty.
string $part: 'year', 'month', 'day', 'hour', 'minute', or 'second. returns info for all parts if empty.
File
- core/
modules/ date/ views/ date_sql_handler.inc, line 448 - SQL helper for Date API.
Class
- date_sql_handler
- A class to manipulate date SQL.
Code
function part_info($op = NULL, $part = NULL) {
$info = array();
$info['min'] = array(
'year' => 100,
'month' => 1,
'day' => 1,
'hour' => 0,
'minute' => 0,
'second' => 0,
);
$info['max'] = array(
'year' => 4000,
'month' => 12,
'day' => 31,
'hour' => 23,
'minute' => 59,
'second' => 59,
);
$info['format'] = array(
'year' => 'Y',
'month' => 'm',
'day' => 'd',
'hour' => 'H',
'minute' => 'i',
'second' => 's',
);
$info['sep'] = array(
'year' => '',
'month' => '-',
'day' => '-',
'hour' => ' ',
'minute' => ':',
'second' => ':',
);
$info['empty_now'] = array(
'year' => date('Y'),
'month' => date('m'),
'day' => min('28', date('d')),
'hour' => date('H'),
'minute' => date('i'),
'second' => date('s'),
);
$info['empty_min'] = array(
'year' => '1000',
'month' => '01',
'day' => '01',
'hour' => '00',
'minute' => '00',
'second' => '00',
);
$info['empty_max'] = array(
'year' => '9999',
'month' => '12',
'day' => '31',
'hour' => '23',
'minute' => '59',
'second' => '59',
);
if (!empty($op)) {
if (!empty($part)) {
return $info[$op][$part];
}
else {
return $info[$op];
}
}
return $info;
}