Skip to content

Commit 13bf5c9

Browse files
committed
feature #14892 [Uid] Document the getDateTime() method (javiereguiluz)
This PR was merged into the 5.3-dev branch. Discussion ---------- [Uid] Document the getDateTime() method Fixes #14887. Commits ------- d0c1a24 [Uid] Document the getDateTime() method
2 parents 127e9a2 + d0c1a24 commit 13bf5c9

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
@@ -107,9 +107,9 @@ UUID objects created with the ``Uuid`` class can use the following methods
107107
$uuid = Uuid::v4();
108108
$uuid instanceof UuidV4; // true
109109

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

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

125+
.. versionadded:: 5.3
126+
127+
The ``getDateTime()`` method was introduced in Symfony 5.3. In previous
128+
versions it was called ``getTime()``.
129+
125130
Storing UUIDs in Databases
126131
~~~~~~~~~~~~~~~~~~~~~~~~~~
127132

@@ -261,14 +266,19 @@ ULID objects created with the ``Ulid`` class can use the following methods::
261266
// checking if a given value is valid as ULID
262267
$isValid = Ulid::isValid($ulidValue); // true or false
263268

264-
// getting the ULID time
265-
$ulid1->getTime(); // e.g. float(1584111384.2613)
269+
// getting the ULID datetime
270+
$ulid1->getDateTime(); // returns a \DateTimeImmutable instance
266271

267272
// comparing ULIDs and checking for equality
268273
$ulid1->equals($ulid2); // false
269274
// this method returns $ulid1 <=> $ulid2
270275
$ulid1->compare($ulid2); // e.g. int(-1)
271276

277+
.. versionadded:: 5.3
278+
279+
The ``getDateTime()`` method was introduced in Symfony 5.3. In previous
280+
versions it was called ``getTime()``.
281+
272282
Storing ULIDs in Databases
273283
~~~~~~~~~~~~~~~~~~~~~~~~~~
274284

0 commit comments

Comments
 (0)