|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.bradrydzewski.gwt.calendar.client.DateUtils
public class DateUtils
Contains utility methods involving dates. This class should remain GWT-API independent.
| Field Summary | |
|---|---|
static long |
MILLIS_IN_A_DAY
|
| Constructor Summary | |
|---|---|
DateUtils()
|
|
| Method Summary | |
|---|---|
static boolean |
areOnTheSameDay(Date dateOne,
Date dateTwo)
Indicates whether two dates are on the same date by comparing their day, month and year values. |
static boolean |
areOnTheSameMonth(Date dateOne,
Date dateTwo)
Indicates whether two dates are on the same month of the same year. |
static void |
copyTime(Date source,
Date target)
Copies the hours, minutes and seconds in the source date into
the target date object. |
static int |
differenceInDays(Date endDate,
Date startDate)
Returns the number of days between the passed dates. |
static Date |
firstOfNextMonth(Date date)
Returns the date corresponding to the first day of the next month relative to the passed date. |
static Date |
firstOfTheMonth(Date anyDayInMonth)
Returns a clone of the anyDayInMonth date set to the
first day of whatever its month is. |
static boolean |
isWeekend(Date day)
|
static int |
minutesSinceDayStarted(Date day)
Returns the amount of minutes elapsed since the beginning of the passed day. |
static Date |
moveOneDayForward(Date date)
Moves the date of the passed object to be one day after whatever date it has. |
static Date |
newDate(Date date)
Creates a new date with whatever date/time the passed date
object represents. |
static Date |
previousDay(Date date)
Returns a day exactly 24 hours before the instant passed as date. |
static void |
resetTime(Date date)
Resets the date to have no time modifiers (hours, minutes, seconds.) |
static Date |
shiftDate(Date date,
int shift)
Moves a date shift days. |
static int |
year(Date date)
Returns the full year (4-digits) of the passed date. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final long MILLIS_IN_A_DAY
| Constructor Detail |
|---|
public DateUtils()
| Method Detail |
|---|
public static int differenceInDays(Date endDate,
Date startDate)
endDate - The upper limit of the date rangestartDate - The lower limit of the date range
endDate and
starDate (inclusive)public static int year(Date date)
date.
date - The date whose year will be returned
date.
public static Date shiftDate(Date date,
int shift)
shift days. A clone of date to
prevent undesired object modifications.
date - The date to shiftshift - The number of days to push the original date
forward
shift days forwardpublic static void resetTime(Date date)
date - The date to reset
public static boolean areOnTheSameDay(Date dateOne,
Date dateTwo)
dateOne - The first date to testdateTwo - The second date to test
true if both dates have their date,
month and year properties with the
exact same values (whatever they are)
public static boolean areOnTheSameMonth(Date dateOne,
Date dateTwo)
dateOne - The first date of the comparisondateTwo - The second date of the comparison
true if both dates have the same year and month,
false otherwisepublic static Date firstOfTheMonth(Date anyDayInMonth)
anyDayInMonth date set to the
first day of whatever its month is.
anyDayInMonth - Any date on a month+year
anyDayInMonth date, representing the
first day of that same month and yearpublic static Date moveOneDayForward(Date date)
date - An object representing a date
public static Date firstOfNextMonth(Date date)
date.
date - The reference date
11) one will be
added to the year of the returned date.public static Date previousDay(Date date)
date. // TODO: This logic should address the time zone
offset
date - A point in time from which the moment 24 hours before will be
calculated
date
public static void copyTime(Date source,
Date target)
source date into
the target date object.
source - The date with the hour, minutes and seconds to be copiedtarget - The date whose time fields will be setpublic static int minutesSinceDayStarted(Date day)
day.
day - The day to calculate the elapsed minutes
day startedpublic static Date newDate(Date date)
date
object represents.
date - The source date
public static boolean isWeekend(Date day)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||