Java UUID.timestamp()

Syntax

UUID.timestamp() has the following syntax.

public long timestamp()

Example

In the following code shows how to use UUID.timestamp() method.


//w  w w. j a v a2  s  .  c o  m

import java.util.UUID;

public class Main {
   public static void main(String[] args) {
      // creating UUID      
      UUID uid = UUID.randomUUID();     
        
      // checking time stamp value
      System.out.println("Time stamp value: "+uid.timestamp());    
   }    
}

The code above generates the following result.