The timestamp() method of UUID class in Java is generally used to get the stamp value associated with a particular UUID.
public long timestamp()
Parameters: This method does not take any parameter.
Return Value: This method returns the time stamp value of this UUID.
Exception: This method throws UnsupportedOperationException if this UUID is not a part of version 1 UUID.
Below programs illustrate the working of timestamp() method:
UUID: 58e0a7d7-eebc-11d8-9669-0800200c9a66 The timestamp value is: 133118681719810007
UUID: 5fc03087-d265-11e7-b8c6-83e29cd24f4c The timestamp value is: 137309646498050183
Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready.