import java.time.LocalDateTime;
import java.time.temporal.ChronoField;
public class MyClass {
public static void main(String args[]) {
LocalDateTime now = LocalDateTime.now();
int year = now.getYear();
int month = now.getMonthValue();
int day = now.getDayOfMonth();
int hour = now.getHour();
int minute = now.getMinute();
int second = now.getSecond();
int millis = now.get(ChronoField.MILLI_OF_SECOND);
System.out.printf("%d-%02d-%02d %02d:%02d:%02d.%03d", year, month, day, hour, minute, second, millis);
}
}
/*
run:
2020-08-09 09:52:11.529
*/