public class CalendarTools extends Object
Constructor and Description |
---|
CalendarTools() |
Modifier and Type | Method and Description |
---|---|
static long |
calculateNewValue(boolean valueIncreases,
long firstDateToDisplay,
CalendarDisplayMode displayMode)
Calculates a new date value based on the given first day to display and the current display mode of the calendar.
|
static long |
getDateEnd(long date) |
static long |
getDateStart(long date)
Gets a
Long that represents the first date in the month
that contains the provided date. |
static long |
getFirstDateInMonth(long date)
Gets a
Long that represents the first date in the month
that contains the provided date. |
static long |
getFirstDateInWeek(long date) |
static long |
getFirstDateInYear(long date) |
static long |
getFirstDateOfWeekWith(Long date)
Gets a
Long representing the first date of the week that contains the
specified displayed date in accordance with the specified calendar. |
static long |
getFirstDisplayDate(Long displayDate)
Gets a
Long that represents the first date that should be displayed
in a month that contains the displayed date in accordance with the specified calendar. |
static long |
getFirstMonthInYear(long date) |
static long |
getLastDateInMonth(long displayDate) |
static long |
getLastDateInWeek(long date) |
static long |
getLastDateInYear(long date) |
static long |
getLastMonthInYear(long displayDate) |
static String |
getShortDayName(int day)
Gets a
String which represent the short name of the day with the
specified index in accordance with the first day of the week
determined by the locale and in the language that it represents. |
static boolean |
isWeekend(long date) |
public static long getDateStart(long date)
Long
that represents the first date in the month
that contains the provided date.date
- the datepublic static boolean isWeekend(long date)
public static long getDateEnd(long date)
public static long getFirstDateInMonth(long date)
Long
that represents the first date in the month
that contains the provided date.date
- the datepublic static long getFirstDateInWeek(long date)
public static long getFirstDateInYear(long date)
public static long getFirstMonthInYear(long date)
public static long calculateNewValue(boolean valueIncreases, long firstDateToDisplay, CalendarDisplayMode displayMode)
valueIncreases
- the new value will be bigger if true
and smaller if false
firstDateToDisplay
- the date from which to calculate the new value.public static long getFirstDisplayDate(Long displayDate)
Long
that represents the first date that should be displayed
in a month that contains the displayed date in accordance with the specified calendar.
For example, if the display date is Tuesday, 1st of February and according to the
specified calendar the first day of the week is Sunday, the returned value will be the
date that was on Sunday on the week that contains the displayed date.
In the example, that is 30th of January.displayDate
- the display datepublic static long getFirstDateOfWeekWith(Long date)
Long
representing the first date of the week that contains the
specified displayed date in accordance with the specified calendar.
For example, if the display date is Tuesday, 1st of February and according to the
specified calendar the first day of the week is Sunday, the returned value will be the
date that was on Sunday on the week that contains the displayed date.
In the example, that is 30th of January.date
- the datepublic static String getShortDayName(int day)
String
which represent the short name of the day with the
specified index in accordance with the first day of the week
determined by the locale and in the language that it represents.
For example, if the locale is en, this means that the language is english and the
first day of the week is Sunday (index 1). If the value of day is 1, the return value will
be Sun. If the value of day is 2, the return value will be Mon, etc.day
- the index of the day of the weekpublic static long getLastDateInMonth(long displayDate)
public static long getLastDateInWeek(long date)
public static long getLastDateInYear(long date)
public static long getLastMonthInYear(long displayDate)