fork(1) download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.time.*;
  4. import java.lang.*;
  5. import java.time.format.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. DateTimeFormatter formatter = new DateTimeFormatterBuilder()
  13. .append(DateTimeFormatter.ISO_LOCAL_DATE)
  14. .appendLiteral(' ')
  15. .append(DateTimeFormatter.ISO_LOCAL_TIME)
  16. .toFormatter();
  17.  
  18. LocalDateTime dt = LocalDate.parse("2018-03-21 00:00:00.0", formatter)
  19. .atTime(LocalTime.of(23, 18, 19));
  20.  
  21. System.out.println(dt.format(formatter));
  22. }
  23. }
Success #stdin #stdout 0.23s 34580KB
stdin
Standard input is empty
stdout
2018-03-21 23:18:19