function date_sql_handler::part_info in Date 6
Same name and namespace in other branches
- 5.2 date_api_sql.inc \date_sql_handler::part_info()
- 6.2 date_api_sql.inc \date_sql_handler::part_info()
- 7.3 date_api/date_api_sql.inc \date_sql_handler::part_info()
- 7 date_api/date_api_sql.inc \date_sql_handler::part_info()
- 7.2 date_api/date_api_sql.inc \date_sql_handler::part_info()
Part information.
Parameters
$op: 'min', 'max', 'format', 'sep', 'empty_now', 'empty_min', 'empty_max'. Returns all info if empty.
$part: 'year', 'month', 'day', 'hour', 'minute', or 'second. returns info for all parts if empty.
1 call to date_sql_handler::part_info()
- date_sql_handler::complete_date in ./
date_api_sql.inc - Create a complete datetime value out of an incomplete array of selected values.
File
- ./
date_api_sql.inc, line 474
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;
}