import hirondelle.date4j.DateTime; public class DateExample { public static void main(String[] args) { DateTime now = DateTime.now(); int year = now.getYear(); int month = now.getMonth(); int day = now.getDay(); String formattedDate = now.format("YYYY/MM/DD hh:mm:ss"); System.out.println("Formatted Date: " + formattedDate); DateTime futureDate = DateTime.forDateOnly(year + 1, month, day); long daysUntilFutureDate = now.numDaysFrom(futureDate); System.out.println("Days Until Future Date: " + daysUntilFutureDate); } }


上一篇:
下一篇:
切换中文