Class DateUtils

java.lang.Object
net.datenwerke.rs.utils.misc.DateUtils

public class DateUtils extends Object
  • Field Details

    • MILLISECS_PER_MINUTE

      public static final long MILLISECS_PER_MINUTE
      All minutes have this many milliseconds except the last minute of the day on a day defined with a leap second.
      See Also:
    • MILLISECS_PER_HOUR

      public static final long MILLISECS_PER_HOUR
      Number of milliseconds per hour, except when a leap second is inserted.
      See Also:
    • EPOCH_UNIX_ERA_DAY

      public static final long EPOCH_UNIX_ERA_DAY
      Value to add to the day number returned by this calendar to find the Julian Day number. This is the Julian Day number for 1/1/1970. Note: Since the unix Day number is the same from local midnight to local midnight adding JULIAN_DAY_OFFSET to that value results in the chronologist, historians, or calenderists Julian Day number. Refer to http://www.hermetic.ch/cal_stud/jdn.htm
      See Also:
  • Method Details

    • getUnixDay

      public static long getUnixDay(Calendar date)
      Returns:
      Day number where day 0 is 1/1/1970, as per the Unix/Java date/time epoch.
    • getJulianDay

      public static long getJulianDay(Calendar date)
      Returns:
      LOCAL Chronologists Julian day number each day starting from midnight LOCAL TIME. Refer to http://tycho.usno.navy.mil/mjd.html for more information about local C-JDN
    • getDeltaDays

      public static int getDeltaDays(Date d1, Date d2)
      Parameters:
      d1 -
      d2 -
      Returns:
      d2 - d1
    • formatDate

      public static String formatDate(Date date, String format)
    • trimSecondsAndMillis

      public static Date trimSecondsAndMillis(Date date)
    • trimTimeInformation

      public static Date trimTimeInformation(Date date)
    • trimDateInformation

      public static Date trimDateInformation(Date date)
    • formatCurrentDate

      public static String formatCurrentDate()
    • format

      public static String format(ZonedDateTime zonedDateTime)
    • toZonedDateTime

      public static ZonedDateTime toZonedDateTime(Date date)
    • format

      public static String format(Date date)
    • formatLocal

      public static String formatLocal(ZonedDateTime zonedDateTime)
    • formatLocal

      public static String formatLocal(Date date)
    • toDate

      public static Date toDate(LocalDateTime localDateTime)
    • toDate

      public static Date toDate(LocalDate localDate)