fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6. import java.text.*;
  7. import java.time.*;
  8.  
  9. /* Name of the class has to be "Main" only if the class is public. */
  10. class Ideone
  11. {
  12.  
  13. public static LocalTime formataData(String data) throws Exception {
  14. if (data == null || data.equals(""))
  15. return null;
  16. LocalTime lt;
  17.  
  18. lt = LocalTime.parse(data);
  19.  
  20. return lt;
  21. }
  22.  
  23. public static void main (String[] args) throws java.lang.Exception
  24. {
  25. String hora = "13:32:00";
  26.  
  27. System.out.println(formataData(hora));
  28. }
  29. }
Success #stdin #stdout 0.23s 320832KB
stdin
Standard input is empty
stdout
13:32