You are here

function date_set_formats in Date 5

1 call to date_set_formats()
date_get_formats in ./date.module

File

./date.module, line 547
Defines a date/time field type.

Code

function date_set_formats($field) {
  if (!empty($field['widget']['input_format_custom'])) {
    $format = $field['widget']['input_format_custom'];
  }
  else {
    $format = $field['widget']['input_format'] == 'site-wide' ? variable_get('date_format_short', 'm/d/Y - H:i') : $field['widget']['input_format'];
  }
  $granularity = date_granularity_array($field);
  $formats = date_formats($format, $granularity);
  cache_set('date_formats:' . $field['field_name'] . ':' . $field['widget']['type'], 'cache', serialize($formats), CACHE_PERMANENT);
  return $formats;
}