You are here

function date_granularity_names in Date 7.3

Same name and namespace in other branches
  1. 5.2 date_api.module \date_granularity_names()
  2. 5 date.inc \date_granularity_names()
  3. 6.2 date_api.module \date_granularity_names()
  4. 6 date_api.module \date_granularity_names()
  5. 7 date_api/date_api.module \date_granularity_names()
  6. 7.2 date_api/date_api.module \date_granularity_names()

Constructs an array of granularity options and their labels.

Return value

array An array of translated date parts, keyed by their machine name.

4 calls to date_granularity_names()
date_tools_wizard_form in date_tools/date_tools.wizard.inc
Implements hook_form().
theme_date_text_parts in ./date.theme
Returns HTML for the text/select options for date parts in a table.
_date_field_settings_form in ./date_admin.inc
Helper function for date_field_settings_form().
_date_field_widget_settings_form in ./date_admin.inc
Helper function for date_field_widget_settings_form().

File

date_api/date_api.module, line 1589
This module will make the date API available to other modules.

Code

function date_granularity_names() {
  return array(
    'year' => t('Year', array(), array(
      'context' => 'datetime',
    )),
    'month' => t('Month', array(), array(
      'context' => 'datetime',
    )),
    'day' => t('Day', array(), array(
      'context' => 'datetime',
    )),
    'hour' => t('Hour', array(), array(
      'context' => 'datetime',
    )),
    'minute' => t('Minute', array(), array(
      'context' => 'datetime',
    )),
    'second' => t('Second', array(), array(
      'context' => 'datetime',
    )),
  );
}