LammaJava 日期处理库
Lamma 日期处理库是一个新的开发包,提供一组简单易用的 API 来做基本的日期处理和复杂任务调度。
示例代码:
new Date(2014, 5, 5)); // create with constructor import static io.lamma.LammaJavaImports.date; date(2014, 10, 7); // create with helper method date("2014-10-07"); // create with ISO 8601 String date(2014, 7, 7).isBefore(date(2014, 7, 8)); // => true date(2016, 3, 3).minus(date(2016, 2, 25)); // => 7, date(2016, 2, 29).plusDays(5); date(2016, 2, 29).minusDays(5); date(2014, 7, 7).is(DayOfWeek.MONDAY); // true date(2014, 7, 7).next(DayOfWeek.MONDAY); // => Date(2014,7,14) date(2014, 7, 7).previous(DayOfWeek.MONDAY); // => Date(2014,6,30) date(2014, 7, 7).nextOrSame(DayOfWeek.MONDAY); // => Date(2014,7,7) date(2014, 7, 7).previousOrSame(DayOfWeek.WEDNESDAY); // => Date(2014,7,2) date(2014, 7, 7).withDayOfWeek(DayOfWeek.MONDAY); // => Date(2014,7,7) date(2014, 7, 7).withDayOfWeek(DayOfWeek.SUNDAY); //=> Date(2014,7,13)
评论