You are here

function date_views_browser_period_arg in Date 5

Same name and namespace in other branches
  1. 5.2 date/date_views.inc \date_views_browser_period_arg()

Format an argument for the date range

2 calls to date_views_browser_period_arg()
theme_date_views_browser_full_view in ./date_views.inc
View, themed so it can be overridden $display -- views_view_list, views_view_table, views_view_teasers, views_view_nodes
_date_views_query_alter in ./date_views.inc
Implementation of hook_views_query() Used to make sure view defaults to current date if no date selected

File

./date_views.inc, line 692

Code

function date_views_browser_period_arg($arg = NULL, $period = 'month') {
  include_once drupal_get_path('module', 'date_api') . '/date.inc';
  switch ($period) {
    case 'week':
      return date_gmdate('Y-m-d', date_views_browser_period_start_stamp($arg, $period)) . date_views_browser_period($period);
    case 'year':
      return date_gmdate('Y', date_views_browser_period_start_stamp($arg, $period)) . date_views_browser_period($period);
    case 'day':
      return date_gmdate('Y-m-d', date_views_browser_period_start_stamp($arg, $period)) . date_views_browser_period($period);
    case 'hour':
      return date_gmdate('Y-m-d\\TH', date_views_browser_period_start_stamp($arg, $period)) . date_views_browser_period($period);
    default:
      return date_gmdate('Y-m', date_views_browser_period_start_stamp($arg, $period)) . date_views_browser_period($period);
  }
}