var clock = Clock.systemUTC(); System.out.println(clock.instant()); System.out.println(clock.millis()); System.out.println(System.currentTimeMillis()); System.out.println(clock.getZone()); var d = Duration.ofSeconds(6000); System.out.println(d.toDays()); System.out.println(d.toMinutes()); System.out.println(d.toHours()); var clock2 = Clock.offset(clock,d); System.out.println(clock2.instant()); var instant = Instant.now(); System.out.println(instant); var instant2 = instant.plusSeconds(6000); System.out.println(instant2); System.out.println(instant.getEpochSecond()); System.out.println(instant2.getEpochSecond()); var instant3 = Instant.parse("2014-02-23T10:12:35.342Z"); var instant4 = instant3.plus(Duration.ofHours(5).plusMinutes(4)); System.out.println(instant4); var instant5 = instant4.minus(Duration.ofDays(5)); var localDate = LocalDate.now(); System.out.println(localDate); localDate = LocalDate.ofYearDay(2014,146); System.out.println(localDate); localDate = LocalDate.of(2014, Month.MAY,21); System.out.println(localDate); var localTime = LocalTime.now(); System.out.println(localTime); localTime = LocalTime.of(23,23); System.out.println(localTime); localTime = LocalTime.ofSecondOfDay(5503); System.out.println(localTime); var localDateTime = LocalDateTime.now(); System.out.println(localDateTime); var future = localDateTime.plusHours(25).plusMinutes(3); System.out.println(future); var year = Year.now(); System.out.println(year); year = year.plusYears(5); System.out.println(year); var ym = year.atMonth(10); System.out.println(ym); var md = MonthDay.now(); System.out.println(md); var md2 = md.with(Month.MAY).withDayOfMonth(23); System.out.println(md2);
output:
2019-07-26T01:41:36.385911400Z 1564105296390 1564105296390 Z 0 100 1 2019-07-26T03:21:36.390898600Z 2019-07-26T01:41:36.390898600Z 2019-07-26T03:21:36.390898600Z 1564105296 1564111296 2014-02-23T15:16:35.342Z 2019-07-26 2014-05-26 2014-05-21 09:41:36.406855600 23:23 01:31:43 2019-07-26T09:41:36.406855600 2019-07-27T10:44:36.406855600 2019 2024 2024-10 --07-26 --05-23