import org.joda.time.DateTime; import org.joda.time.format.DateTimeFormat; import org.joda.time.format.DateTimeFormatter; public class DateCalcExample { public static void main(String[] args) { DateTimeFormatter formatter = DateTimeFormat.forPattern("yyyy-MM-dd"); DateTime currentDate = new DateTime(); } } DateTime currentDate = new DateTime(); DateTime futureDate = currentDate.plusDays(7); DateTime pastDate = currentDate.minusMonths(1); boolean isAfter = futureDate.isAfter(currentDate); boolean isBefore = pastDate.isBefore(currentDate); boolean isEqual = currentDate.isEqual(currentDate); DateTime utcDateTime = new DateTime(DateTimeZone.UTC); DateTime localDateTime = utcDateTime.withZone(DateTimeZone.getDefault());


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