Java Data Type Tutorial - 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.

/*from   w  w  w  . j  a v a  2  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.