How do i display format_interval? In Drupal 8 I am using 

$date_service = \Drupal::service('date');
$options = drupal_map_assoc(array(900, 1800, 3600, 7200, 10800, 21600, 32400, 43200,
  64800, 86400, 172800, 259200, 604800, 1209600, 2419200), array($date_service, 'formatInterval'));


But this gives me error 


  Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException:
  You have requested a non-existent service "date". Did you mean one of
  these: "theme.negotiator.system.db_update",
  "entity.definition_update_manager", "date.formatter",
  "update.post_update_registry", "update.post_update_registry_factory",
  "access_check.db_update", "access_check.update.manager_access",
  "update.manager", "update.processor", "update.fetcher", "update.root"?
  in Drupal\Component\DependencyInjection\Container->get() (line 161 of
  /Applications/MAMP/htdocs/drupal-8.0.x-dev/core/lib/Drupal/Component/DependencyInjection/Container.php).


What wrong am i doing? Am i missing use class something like this use Drupal.... or something wrong in line $date_service = \Drupal::service('date');
My piece of working code:

$time_intervals = array(30, 3600, 10800, 21600, 43200, 86400, 172800, 259200, 604800, 1209600, 2592000, 5184000, 7776000);

$options = $this-&gt;build_options($time_intervals);


Also i have defined following function in the same class:

function build_options(array $time_intervals, $granularity = 2, $langcode = NULL) {
  $callback = function ($value) use ($granularity, $langcode) {
    return \Drupal::service('date.formatter')-&gt;formatInterval($value, $granularity, $langcode);
  };

  return array_combine($time_intervals, array_map($callback, $time_intervals));
}