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');