public static function DateGranularity::partFormat in Date 8
Helper function to get a format for a specific part of a date field.
Parameters
string $part: The date field part, either 'time' or 'date'.
string $format: A date format string.
Return value
string The date format for the given part.
File
- date_api/
lib/ Drupal/ date_api/ DateGranularity.php, line 476 - Definition of DateGranularity.
Class
- DateGranularity
- This class manages granularity. It can set granularity, get it from an array, get it from a format string, see if the array has any time or date elements, set and unset various granularity parts, create a nongranularity array of the granularity parts…
Namespace
Drupal\date_apiCode
public static function partFormat($part, $format) {
switch ($part) {
case 'date':
return self::limitFormat($format, self::$date_parts);
case 'time':
return self::limitFormat($format, self::$time_parts);
default:
return self::limitFormat($format, array(
$part,
));
}
}