public class DateHelper extends Object
| Modifier and Type | Field and Description |
|---|---|
static long |
DAYS
a day in milli seconds
|
static int |
DAYS_IN_SEC
a day in seconds
|
static long |
HOURS
an hour in milli seconds
|
static int |
HOURS_IN_SEC
a hour in seconds
|
static long |
MILLI_SECONDS
a milli seconds
|
static long |
MINUTES
a minute in milli seconds
|
static int |
MINUTES_IN_SEC
a minutes in seconds
|
static long |
SECONDS
a second in milli seconds
|
static int |
SECONDS_IN_SEC
a second in seconds
|
| Modifier and Type | Method and Description |
|---|---|
static boolean |
isTheSameDay(Calendar dayOne,
Calendar dayTwo)
Check if the calendars are referring to the same day
|
static boolean |
isTheSameDay(Date dayOne,
Date dayTwo)
Check if the dates are referring to the same day
|
static boolean |
isTheSameDay(Date dayOne,
Date dayTwo,
TimeZone userTimeZone)
Check if the dates are referring to the same day and add set the timezone
|
static boolean |
isToday(Date day)
Check if the dates are referring to the same day
|
static long |
nowBefore(long time)
Use as
nowBefore(14*DateHelper.DAYS) |
static long |
nowBeforeTrimToMidnight(long time)
Subtract the time from now and reset the time of the given day
|
static long |
nowBeforeXMonths(int x)
Use as
nowBeforeXMonths(1) to get the time of today before one month |
public static final long MILLI_SECONDS
public static final long SECONDS
public static final int SECONDS_IN_SEC
public static final long MINUTES
public static final int MINUTES_IN_SEC
public static final long HOURS
public static final int HOURS_IN_SEC
public static final long DAYS
public static final int DAYS_IN_SEC
public static boolean isTheSameDay(Calendar dayOne, Calendar dayTwo)
dayOne - the day onedayTwo - the day twopublic static boolean isTheSameDay(Date dayOne, Date dayTwo)
dayOne - the day onedayTwo - the day twopublic static boolean isTheSameDay(Date dayOne, Date dayTwo, TimeZone userTimeZone)
dayOne - the day one with respect to the timezonedayTwo - the day two with respect to the timezoneuserTimeZone - for timezone specific comparison; can be nullpublic static boolean isToday(Date day)
day - the day onepublic static long nowBefore(long time)
nowBefore(14*DateHelper.DAYS)time - the time to subtract from nowpublic static long nowBeforeTrimToMidnight(long time)
time - the time to subtract from nowpublic static long nowBeforeXMonths(int x)
nowBeforeXMonths(1) to get the time of today before one monthx - the number of months to substract from todayCopyright © 2019 Communote team. All rights reserved.