import org.apache.commons.lang3.time.DateUtils; import java.text.SimpleDateFormat; import java.util.Date; public class DateUtilsExample { public static void main(String[] args) throws Exception { Date currentDate = new Date(); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String formattedDate = sdf.format(currentDate); Date threeMonthsLater = DateUtils.addMonths(currentDate, 3); String formattedThreeMonthsLater = sdf.format(threeMonthsLater); boolean isLeapYear = DateUtils.isLeapYear(2022); } }


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