Validate date format string submission.
function system_date_formats_form_validate($form, &$form_state) {
$formats = system_get_date_formats();
$format = trim($form_state['values']['date_format_pattern']);
// The machine name field should already check to see if the requested
// machine name is available. Regardless of machine_name or human readable
// name, check to see if the provided pattern exists.
if (!empty($formats) && in_array($format, array_values($formats)) && (!isset($form_state['values']['date_format_id']) || $form_state['values']['date_format_id'] != $formats[$format]['date_format_id'])) {
form_set_error('date_format', t('This format already exists. Enter a unique format string.'));
}
}