1 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

core/includes/date.inc, line 1136
Date API functions.

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));
  }
}