public class DateTools
extends java.lang.Object
- public Date getDate()
- public GregorianCalendar getCalendar()
- public DateContainer getTestObject()
- public GregorianCalendar[] getSundays(int year)
- public List getSaturdays(int year)
- public Map getWeekends(int year)
- public String getDayOfWeek(GregorianCalendar date)
- public Date[] sortByDayOfWeek(ArrayList dates)
- public Date[] sortByDayOfYear(Date[] dates)
Constructor and Description |
---|
DateTools() |
Modifier and Type | Method and Description |
---|---|
static java.util.GregorianCalendar |
getCalendar()
Returns today as a java.util.GregorianCalendar object.
|
static java.util.Date |
getDate()
Returns today as a java.util.Date object.
|
static DateContainer |
getDateContainer()
Returns an object with a set of different Date and Calendar attributes.
|
static java.lang.String |
getDayOfWeek(java.util.GregorianCalendar date)
Returns the day of week of the given date.
|
static java.util.List<java.util.Date> |
getSaturdays(int year)
Returns a list of all saturdays of the given year.
|
static java.util.GregorianCalendar[] |
getSundays(int year)
Returns an array of all sundays of the given year.
|
static java.util.Map<java.util.Date,java.lang.String> |
getWeekends(int year)
Returns a map of all weekends in the given year.
|
static java.util.Date[] |
sortByDayOfWeek(java.util.List<java.util.GregorianCalendar> dates)
Returns a sorted array of
|
static java.util.Set<java.util.Date> |
sortByDayOfYear(java.util.Date[] dates) |
public static java.util.Date getDate()
public static java.util.GregorianCalendar getCalendar()
public static DateContainer getDateContainer()
public static java.util.GregorianCalendar[] getSundays(int year)
year
- The year to retrieve the sundays.public static java.util.List<java.util.Date> getSaturdays(int year)
year
- The year to retrieve the saturdays.public static java.util.Map<java.util.Date,java.lang.String> getWeekends(int year)
java.util.Date
and the value is of type
java.lang.String
.year
- The year to retrieve the weekends.public static java.lang.String getDayOfWeek(java.util.GregorianCalendar date)
date
- The day to retrieve the day of week from.public static java.util.Date[] sortByDayOfWeek(java.util.List<java.util.GregorianCalendar> dates)
dates
- The list of dates. All objects must be of type java.util.Date
.public static java.util.Set<java.util.Date> sortByDayOfYear(java.util.Date[] dates)