Add gets the current day of year. (#968)
This commit is contained in:
parent
ff733d9d9b
commit
59d201f7be
|
@ -77,6 +77,16 @@ public class CalendarUtils {
|
||||||
return calendar.get(Calendar.DAY_OF_MONTH);
|
return calendar.get(Calendar.DAY_OF_MONTH);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the current day of year.
|
||||||
|
*
|
||||||
|
* @return the current day of year.
|
||||||
|
* @since 3.13.0
|
||||||
|
*/
|
||||||
|
public int getDayOfYear() {
|
||||||
|
return calendar.get(Calendar.DAY_OF_YEAR);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the current month.
|
* Gets the current month.
|
||||||
*
|
*
|
||||||
|
|
|
@ -32,6 +32,11 @@ public class CalendarUtilsTest extends AbstractLangTest {
|
||||||
assertEquals(Calendar.getInstance().get(Calendar.DAY_OF_MONTH), CalendarUtils.INSTANCE.getDayOfMonth());
|
assertEquals(Calendar.getInstance().get(Calendar.DAY_OF_MONTH), CalendarUtils.INSTANCE.getDayOfMonth());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testGetDayOfYear() {
|
||||||
|
assertEquals(Calendar.getInstance().get(Calendar.DAY_OF_YEAR), CalendarUtils.INSTANCE.getDayOfYear());
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetMonth() {
|
public void testGetMonth() {
|
||||||
assertEquals(Calendar.getInstance().get(Calendar.MONTH), CalendarUtils.INSTANCE.getMonth());
|
assertEquals(Calendar.getInstance().get(Calendar.MONTH), CalendarUtils.INSTANCE.getMonth());
|
||||||
|
|
Loading…
Reference in New Issue