You are here

public static function Drupal::time in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal.php \Drupal::time()
  2. 9 core/lib/Drupal.php \Drupal::time()

Returns the time service.

Return value

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

55 calls to Drupal::time()
CommentPreviewTest::testCommentEditPreviewSave in core/modules/comment/tests/src/Functional/CommentPreviewTest.php
Tests comment edit, preview, and save.
ConfigTranslationViewListUiTest::testTimestampFormatterTranslation in core/modules/config_translation/tests/src/Functional/ConfigTranslationViewListUiTest.php
Test to ensure that TimestampFormatter translation works.
CronQueueTest::setUp in core/modules/system/tests/src/Kernel/System/CronQueueTest.php
CronQueueTest::testExceptions in core/modules/system/tests/src/Kernel/System/CronQueueTest.php
Tests that exceptions thrown by workers are handled properly.
DatabaseQueue::claimItem in core/lib/Drupal/Core/Queue/DatabaseQueue.php

... See full list

File

core/lib/Drupal.php, line 721

Class

Drupal
Static Service Container wrapper.

Code

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