Skip to content

Instantly share code, notes, and snippets.

@nonsie
Created September 29, 2014 16:37
Show Gist options
  • Save nonsie/a5aa338088d39ab23c5e to your computer and use it in GitHub Desktop.
Save nonsie/a5aa338088d39ab23c5e to your computer and use it in GitHub Desktop.
D7 custom date format
/**
* Note that the new format won't be visible unless you go save the date formats page or call drupal_static_reset('date_format_type_format')
*/
/**
* Implements hook_date_formats().
*/
function mymodule_date_formats() {
$formats = array();
$formats[] = array(
'type' => 'mymodule_date_long',
'format' => 'd-M-Y H:i',
'locales' => array(),
);
return $formats;
}
/**
* Implements hook_date_format_types().
*/
function mymodule_date_format_types() {
$types = array();
$types['mymodule_date_long'] = t('My Long Date Format');
return $types;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment