function Drupal::time

Same name in other branches
  1. 9 core/lib/Drupal.php \Drupal::time()
  2. 8.9.x core/lib/Drupal.php \Drupal::time()
  3. 11.x core/lib/Drupal.php \Drupal::time()

Returns the time service.

Return value

\Drupal\Component\Datetime\TimeInterface The time service.

5 calls to Drupal::time()
DatabaseStorageExpirable::__construct in core/lib/Drupal/Core/KeyValueStore/DatabaseStorageExpirable.php
Overrides Drupal\Core\KeyValueStore\StorageBase::__construct().
GarbageCollectionTest::testGarbageCollection in core/tests/Drupal/KernelTests/Core/KeyValueStore/GarbageCollectionTest.php
Tests garbage collection.
MigrateUpgradeImportBatch::onPostRowDelete in core/modules/migrate_drupal_ui/src/Batch/MigrateUpgradeImportBatch.php
Reacts to item deletion.
MigrateUpgradeImportBatch::onPostRowSave in core/modules/migrate_drupal_ui/src/Batch/MigrateUpgradeImportBatch.php
Reacts to item import.
TaxonomyTermArgumentDepthTest::setUp in core/modules/taxonomy/tests/src/Kernel/Views/TaxonomyTermArgumentDepthTest.php

File

core/lib/Drupal.php, line 734

Class

Drupal
Static Service Container wrapper.

Code

public static function time() {
    return static::getContainer()->get('datetime.time');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.