You are here

function system_date_time_lookup in Drupal 7

Same name and namespace in other branches
  1. 6 modules/system/system.admin.inc \system_date_time_lookup()

Return the date for a given format string via Ajax.

1 string reference to 'system_date_time_lookup'
system_menu in modules/system/system.module
Implements hook_menu().

File

modules/system/system.admin.inc, line 2205
Admin page callbacks for the system module.

Code

function system_date_time_lookup() {

  // This callback is protected with a CSRF token because user input from the
  // query string is reflected in the output.
  if (!isset($_GET['token']) || !drupal_valid_token($_GET['token'], 'admin/config/regional/date-time/formats/lookup')) {
    return MENU_ACCESS_DENIED;
  }
  $result = format_date(REQUEST_TIME, 'custom', $_GET['format']);
  drupal_json_output($result);
}