function locale_date_format_save
locale_date_format_save($langcode, $type, $format)
Save locale specific date formats to the database.
Parameters
$langcode: Language code, can be 2 characters, e.g. 'en' or 5 characters, e.g. 'en-CA'.
$type: Date format type, e.g. 'short', 'medium'.
$format: The date format string.
File
- includes/locale.inc, line 2417
- Administration functions for locale.module.
Code
function locale_date_format_save($langcode, $type, $format) { $locale_format = array(); $locale_format['language'] = $langcode; $locale_format['type'] = $type; $locale_format['format'] = $format; $is_existing = (bool) db_query_range('SELECT 1 FROM {date_format_locale} WHERE language = :langcode AND type = :type', 0, 1, array(':langcode' => $langcode, ':type' => $type))->fetchField(); if ($is_existing) { $keys = array('type', 'language'); drupal_write_record('date_format_locale', $locale_format, $keys); } else { drupal_write_record('date_format_locale', $locale_format); } }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/includes!locale.inc/function/locale_date_format_save/7.x