package datumesido; import java.time.LocalDate; import java.time.LocalTime; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; public class DatumEsIdo { public static void main(String[] args) { // Dátum System.out.println(LocalDate.now()); System.out.println("******************"); // Időmérés I. // System.nanoTime(); System.out.println( System.currentTimeMillis() ); for (double i = 0; i < 100000000; i++) { } // System.nanoTime(); System.out.println( System.currentTimeMillis() ); System.out.println("******************"); // Időmérés II. System.out.println(LocalTime.now()); for (double i = 0; i < 100000000; i++) { } System.out.println(LocalTime.now()); System.out.println("******************"); // Formázás LocalDateTime datum = LocalDateTime.now(); DateTimeFormatter formatum = DateTimeFormatter.ofPattern("yyyy.MMM d (EEEE), HH:mm:ss:ms"); String formazottDatum = datum.format(formatum); System.out.println(formazottDatum); } }