Skip to content

Commit d0c1a24

Browse files
committed
[Uid] Document the getDateTime() method
1 parent 1c6c658 commit d0c1a24

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

components/uid.rst

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,9 @@ UUID objects created with the ``Uuid`` class can use the following methods
9696
$uuid = Uuid::v4();
9797
$uuid instanceof UuidV4; // true
9898

99-
// getting the UUID time (it's only available in certain UUID types)
99+
// getting the UUID datetime (it's only available in certain UUID types)
100100
$uuid = Uuid::v1();
101-
$uuid->getTime(); // e.g. float(1584111384.2613)
101+
$uuid->getDateTime(); // returns a \DateTimeImmutable instance
102102

103103
// comparing UUIDs and checking for equality
104104
$uuid1 = Uuid::v1();
@@ -111,6 +111,11 @@ UUID objects created with the ``Uuid`` class can use the following methods
111111
// * int < 0 if $uuid1 is less than $uuid4
112112
$uuid1->compare($uuid4); // e.g. int(4)
113113

114+
.. versionadded:: 5.3
115+
116+
The ``getDateTime()`` method was introduced in Symfony 5.3. In previous
117+
versions it was called ``getTime()``.
118+
114119
Storing UUIDs in Databases
115120
~~~~~~~~~~~~~~~~~~~~~~~~~~
116121

@@ -250,14 +255,19 @@ ULID objects created with the ``Ulid`` class can use the following methods::
250255
// checking if a given value is valid as ULID
251256
$isValid = Ulid::isValid($ulidValue); // true or false
252257

253-
// getting the ULID time
254-
$ulid1->getTime(); // e.g. float(1584111384.2613)
258+
// getting the ULID datetime
259+
$ulid1->getDateTime(); // returns a \DateTimeImmutable instance
255260

256261
// comparing ULIDs and checking for equality
257262
$ulid1->equals($ulid2); // false
258263
// this method returns $ulid1 <=> $ulid2
259264
$ulid1->compare($ulid2); // e.g. int(-1)
260265

266+
.. versionadded:: 5.3
267+
268+
The ``getDateTime()`` method was introduced in Symfony 5.3. In previous
269+
versions it was called ``getTime()``.
270+
261271
Storing ULIDs in Databases
262272
~~~~~~~~~~~~~~~~~~~~~~~~~~
263273

0 commit comments

Comments
 (0)