Created
September 29, 2014 16:37
-
-
Save nonsie/a5aa338088d39ab23c5e to your computer and use it in GitHub Desktop.
D7 custom date format
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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