Define additional date types.
Next to the 'long', 'medium' and 'short' date types defined in core, any module can define additional types that can be used when displaying dates, by implementing this hook. A date type is basically just a name for a date format.
Date types are used in the administration interface: a user can assign date format types defined in hook_date_formats() to date types defined in this hook. Once a format has been assigned by a user, the machine name of a type can be used in the format_date() function to format a date using the chosen formatting.
To define a date type in a module and make sure a format has been assigned to it, without requiring a user to visit the administrative interface, use
variable_set('date_format_' . $type, $format);
where $type is the machine-readable name defined here, and $format is a PHP date format string.
To avoid namespace collisions with date types defined by other modules, it is recommended that each date type starts with the module name. A date type can consist of letters, numbers and underscores.
An array of date types where the keys are the machine-readable names and the values are the human-readable labels.
Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.
function hook_date_format_types() {
// Define the core date format types.
return array(
'long' => t('Long'),
'medium' => t('Medium'),
'short' => t('Short'),
);
}