1.20.x date.inc date_part_format($part, $format)

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

includes/date.inc, line 1134
Date API functions and constants.

Code

function date_part_format($part, $format) {
  switch ($part) {
    case 'date':
      return date_limit_format($format, array('year', 'month', 'day'));

    case 'time':
      return date_limit_format($format, array('hour', 'minute', 'second'));

    default:
      return date_limit_format($format, array($part));
  }
}