Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. UuidFactory.php

function UuidFactory::uuid7

Returns a version 7 (Unix Epoch time) UUID

Parameters

DateTimeInterface|null $dateTime An optional date/time from which: to create the version 7 UUID. If not provided, the UUID is generated using the current date/time.

Return value

UuidInterface A UuidInterface instance that represents a version 7 UUID

File

vendor/ramsey/uuid/src/UuidFactory.php, line 403

Class

UuidFactory

Namespace

Ramsey\Uuid

Code

public function uuid7(?DateTimeInterface $dateTime = null) : UuidInterface {
    assert($this->unixTimeGenerator instanceof UnixTimeGenerator);
    $bytes = $this->unixTimeGenerator
        ->generate(null, null, $dateTime);
    return $this->uuidFromBytesAndVersion($bytes, Uuid::UUID_TYPE_UNIX_TIME);
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal