Exactly what I was looking for, ty vm!

Looks like the discussion didn't get very far though.

Since it was your comment @Alan Bateman <[email protected]>, any
thoughts on the follow-up question about an entirely new method for
extracting time, like UUID.toInstant()?

Returning j.t.Instant would side-step the problem entirely, shifting the
complexity from the api to the implementation instead. Plus, strongly-typed
is safer, for a very reasonable performance cost. And those that need speed
can just use the original timestamp().

Please let me know if this idea makes sense, or if you foresee issues.

On Sun, Apr 26, 2026 at 10:05 PM Jaikiran Pai <[email protected]>
wrote:

> Hello David,
>
> On 27/04/26 7:21 am, David Alayachew wrote:
> > Hello @core-libs-dev <[email protected]>,
> >
> > Today was the first time I used the UUID library past UUID.randomUUID()
> and
> > UUID.fromString(String).
> >
> > I saw that UUID.ofEpochMillis(long timestamp) has the ability to create a
> > UUID version 7 UUID -- a time-based UUID! Great, I also see that there
> is a
> > UUID.timestamp() method, can I use that to extract the timestamp from it?
> >
> > Sadly, no. The UUID.timestamp() method is reserved for UUID version 1,
> > whereas UUID.ofEpochMillis(long timestamp) generates UUID version 7.
> >
> > Ok, fair, the documentation is clear. But why can't we just add that
> > functionality to UUID.timestamp()? It's not that complex.
>
> This and other similar questions were discussed during the review of
> https://bugs.openjdk.org/browse/JDK-8334015. The PR here
> https://github.com/openjdk/jdk/pull/25303 (or its corresponding mailing
> list thread in core-libs-dev) has all those discussions. For this
> specific question, the discussion is here
> https://mail.openjdk.org/pipermail/core-libs-dev/2025-September/152621.html
>
> -Jaikiran
>
>
> >
> > Alternatively, could we add a method that returns something more strongly
> > typed, like UUID.extractInstant()? Then, we can leave this method alone,
> > and just make a new one.
> >
> > Thank you for your time and consideration.
> > David Alayachew
>

Reply via email to