fork(2) download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7.  
  8. import java.time.* ;
  9. import java.time.temporal.* ;
  10. import java.time.format.* ;
  11.  
  12.  
  13.  
  14.  
  15. /* Name of the class has to be "Main" only if the class is public. */
  16. class Ideone
  17. {
  18. public static void main (String[] args) throws java.lang.Exception
  19. {
  20.  
  21. String input = "00:12:34.567891" ;
  22. LocalTime lt = LocalTime.parse( input );
  23. Duration d = Duration.between( LocalTime.MIN , lt ) ;
  24. long millis = d.toMillis() ;
  25.  
  26. System.out.println( "input: " + input + " = d.toString(): " + d + " = millis: " + millis );
  27.  
  28.  
  29. }
  30. }
Success #stdin #stdout 0.15s 4575232KB
stdin
Standard input is empty
stdout
input: 00:12:34.567891 = d.toString(): PT12M34.567891S = millis: 754567