Created
November 8, 2013 13:35
-
-
Save DuaelFr/7371124 to your computer and use it in GitHub Desktop.
Set drupal date formats in the code.
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
<?php | |
/* | |
* Implements hook_date_format_types(). | |
*/ | |
function mymodule_date_format_types() { | |
variable_set('date_format_date_only', 'd/m/Y'); | |
variable_set('date_format_date_only_evt', 'd F Y'); | |
return array( | |
'date_only' => t('Date only'), | |
'date_only_evt' => t('Date only event'), | |
); | |
} | |
/* | |
* Implements hook_date_formats(). | |
*/ | |
function mymodule_date_formats() { | |
$formats = array(); | |
// Short date formats. | |
$formats[] = array( | |
'type' => 'date_only', | |
'format' => 'd/m/Y', | |
'locales' => array(), | |
); | |
$formats[] = array( | |
'type' => 'date_only_evt', | |
'format' => 'd F Y', | |
'locales' => array(), | |
); | |
return $formats; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment