Package com.spun.util

Class DateUtils

java.lang.Object
com.spun.util.DateUtils

public class DateUtils extends Object
A static class of convenience functions for database access
  • Constructor Details

    • DateUtils

      public DateUtils()
  • Method Details

    • isSame

      public static boolean isSame(Date firstDate, Date secondDate, int smallestUnits)
    • isSame

      public static boolean isSame(Calendar firstDate, Calendar secondDate, int smallestUnits)
    • isSame

      public static boolean isSame(Date firstDate, Calendar secondDate, int smallestUnits)
    • isSame

      public static boolean isSame(Calendar firstDate, Date secondDate, int smallestUnits)
    • isSame

      public static boolean isSame(long firstDate, long secondDate, int smallestUnits)
    • getStartOfYear

      public static Timestamp getStartOfYear()
    • getStartOfToday

      public static Timestamp getStartOfToday()
    • getStartOfXDaysAgo

      public static Timestamp getStartOfXDaysAgo(int numberOfDays)
    • getStartOfXDaysAgo

      public static Timestamp getStartOfXDaysAgo(int numberOfDays, Date startingFrom)
    • getEndOfTodayAsCalendar

      public static Calendar getEndOfTodayAsCalendar()
    • getEndOfToday

      public static Timestamp getEndOfToday()
    • setSignificantDigit

      public static Calendar setSignificantDigit(Date date, int smallestUnits)
    • setSignificantDigit

      public static Calendar setSignificantDigit(Calendar calendar, int smallestUnits)
    • getStartOf

      public static Timestamp getStartOf(int unit, Date forDate)
    • getEndOf

      public static Timestamp getEndOf(int unit, Date forDate)
    • areSame

      public static boolean areSame(Date date1, Date date2, long accuracy)
    • compareDates

      public static int compareDates(Date date1, Date date2)
      return 1 if date1 > date2, 0 if date1 = date2, -1 if date1 < date2
    • createTime

      public static Date createTime(Date date)
    • rollTillHour

      public static Date rollTillHour(int hour, Date date)
      Rolls back till that time on a 24 hour clock
    • main

      public static void main(String[] args)
    • rollToEndOfDay

      public static GregorianCalendar rollToEndOfDay(Date date)
    • asTimestamp

      public static Timestamp asTimestamp(Date date)
    • isToday

      public static boolean isToday(Date date)
    • asCalendar

      public static Calendar asCalendar(Date date)
    • getLastOrCurrent

      public static Timestamp getLastOrCurrent(int dayOfWeek)
    • getNextOrCurrent

      public static Timestamp getNextOrCurrent(int dayOfWeek)
    • parse

      public static Timestamp parse(String date)
      Parameters:
      date - "yyyy/MM/dd"
    • doesDaylightSavingsTimeStartOn

      public static boolean doesDaylightSavingsTimeStartOn(String date)
    • toDateInLocalTimeZone

      public static Date toDateInLocalTimeZone(LocalDateTime dateTime)
    • toDateInUTC

      public static Date toDateInUTC(LocalDateTime dateTime)
    • toDate

      public static Date toDate(LocalDateTime dateTime, ZoneId zoneId)
    • setTime

      public static Calendar setTime(Calendar day, int hour, int minute)