public class DateUtils extends Object
| Constructor and Description |
|---|
DateUtils() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
areSame(Date date1,
Date date2,
long accuracy) |
static Calendar |
asCalendar(Date date) |
static Timestamp |
asTimestamp(Date date) |
static int |
compareDates(Date date1,
Date date2)
return 1 if date1 > date2, 0 if date1 = date2, -1 if date1 < date2 |
static Date |
createTime(Date date) |
static boolean |
doesDaylightSavingsTimeStartOn(String date) |
static Timestamp |
getEndOf(int unit,
Date forDate) |
static Timestamp |
getEndOfToday() |
static Calendar |
getEndOfTodayAsCalendar() |
static Timestamp |
getLastOrCurrent(int dayOfWeek) |
static Timestamp |
getNextOrCurrent(int dayOfWeek) |
static Timestamp |
getStartOf(int unit,
Date forDate) |
static Timestamp |
getStartOfToday() |
static Timestamp |
getStartOfXDaysAgo(int numberOfDays) |
static Timestamp |
getStartOfXDaysAgo(int numberOfDays,
Date startingFrom) |
static Timestamp |
getStartOfYear() |
static boolean |
isSame(Calendar firstDate,
Calendar secondDate,
int smallestUnits) |
static boolean |
isSame(Calendar firstDate,
Date secondDate,
int smallestUnits) |
static boolean |
isSame(Date firstDate,
Calendar secondDate,
int smallestUnits) |
static boolean |
isSame(Date firstDate,
Date secondDate,
int smallestUnits) |
static boolean |
isSame(long firstDate,
long secondDate,
int smallestUnits) |
static boolean |
isToday(Date date) |
static void |
main(String[] args) |
static Timestamp |
parse(String date) |
static Date |
rollTillHour(int hour,
Date date)
Rolls back till that time on a 24 hour clock
|
static GregorianCalendar |
rollToEndOfDay(Date date) |
static Calendar |
setSignificantDigit(Calendar calendar,
int smallestUnits) |
static Calendar |
setSignificantDigit(Date date,
int smallestUnits) |
static Calendar |
setTime(Calendar day,
int hour,
int minute) |
static Date |
toDate(LocalDateTime dateTime,
ZoneId zoneId) |
static Date |
toDateInLocalTimeZone(LocalDateTime dateTime) |
static Date |
toDateInUTC(LocalDateTime dateTime) |
public static boolean isSame(long firstDate,
long secondDate,
int smallestUnits)
public static Timestamp getStartOfYear()
public static Timestamp getStartOfToday()
public static Timestamp getStartOfXDaysAgo(int numberOfDays)
public static Calendar getEndOfTodayAsCalendar()
public static Timestamp getEndOfToday()
public static Calendar setSignificantDigit(Calendar calendar, int smallestUnits)
public static int compareDates(Date date1, Date date2)
return 1 if date1 > date2, 0 if date1 = date2, -1 if date1 < date2 public static Date rollTillHour(int hour, Date date)
public static void main(String[] args)
public static GregorianCalendar rollToEndOfDay(Date date)
public static boolean isToday(Date date)
public static Timestamp getLastOrCurrent(int dayOfWeek)
public static Timestamp getNextOrCurrent(int dayOfWeek)
public static boolean doesDaylightSavingsTimeStartOn(String date)
public static Date toDateInLocalTimeZone(LocalDateTime dateTime)
public static Date toDateInUTC(LocalDateTime dateTime)
public static Date toDate(LocalDateTime dateTime, ZoneId zoneId)
Copyright © 2022. All rights reserved.