How can I return LocalDate.now() in milliseconds?
问题 I create date now: ZoneId gmt = ZoneId.of("GMT"); LocalDateTime localDateTime = LocalDateTime.now(); LocalDate localDateNow = localDateTime.toLocalDate(); Then I want return this date in milliseconds: localDateNow.atStartOfDay(gmt) - 22.08.2017 localDateNow.atStartOfDay(gmt).toEpochSecond(); - 1503360000 (18.01.70) How can I return LocalDate.now() in milliseconds? 回答1: Calling toInstant().toEpochMilli() , as suggested by @JB Nizet's comment, is the right answer, but there's a little and