只需减去31天。例如:
LocalDate current = new LocalDate(2015, 6, 19);LocalDate x = current.minusDays(31); // 2015-05-19
要 获取 当前日期,可以使用:
LocalDate current = new LocalDate(); // Default time zone
要么
LocalDate current = new LocalDate(zone); // Some specific zone
或者,您可能想要创建自己的“时钟”表示形式,该表示形式能够为您提供current
Instant,在这种情况下,您将使用:
LocalDate current = clock.getCurrentInstant().toDateTime(zone).toLocalDate();
(这使您可以使用依赖项注入使用伪造的时钟编写更简单的单元测试。)



