function DateSqlHandler::part_info in Date 8
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.
1 call to DateSqlHandler::part_info()
- DateSqlHandler::complete_date in date_api/
lib/ Drupal/ date_api/ DateSqlHandler.php - Create a complete datetime value out of an incomplete array of selected values.
File
- date_api/
lib/ Drupal/ date_api/ DateSqlHandler.php, line 652
Class
- DateSqlHandler
- A class to manipulate date SQL.
Namespace
Drupal\date_apiCode
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;
}