Class DateRangeUtil

java.lang.Object
io.keikai.model.impl.sys.DateRangeUtil

public final class DateRangeUtil extends Object
Static utility methods that compute Excel-serial date ranges for named relative periods (today, tomorrow, this week, last month, etc.). Replaces the calc* family of POI's org.apache.poi.ss.usermodel.DateUtil.

Reference (clean-room): Apache POI 5.x DateUtil.java, methods tagged ZSS-1234 / ZSS-1142 (originally contributed back to POI from the Keikai/zss codebase, Apache 2.0).

Since:
7.0.0
  • Method Summary

    Modifier and Type
    Method
    Description
    static double[]
    [today - 6, today + 1).
    static double[]
    [start-of-last-month, start-of-this-month).
    static double[]
    [start-of-last-quarter, start-of-this-quarter).
    static double[]
    [start-of-last-week, start-of-this-week).
    static double[]
    [Jan 1 of last year, Jan 1 of this year).
    static double[]
    [start-of-next-month, start-of-month-after-that).
    static double[]
    [start-of-next-quarter, start-of-quarter-after-that).
    static double[]
    [start-of-next-week, start-of-week-after-that).
    static double[]
    [Jan 1 of next year, Jan 1 of year after that).
    static double[]
    [start-of-this-month, start-of-next-month).
    static double[]
    [start-of-this-quarter, start-of-next-quarter).
    static double[]
    [start-of-this-week, start-of-next-week).
    static double[]
    [Jan 1 of this year, Jan 1 of next year).
    static double[]
    [today 00:00, tomorrow 00:00).
    static double[]
    [tomorrow 00:00, day-after-tomorrow 00:00).
    static double[]
    [Jan 1 of this year, tomorrow 00:00).
    static double[]
    [yesterday 00:00, today 00:00).
    static double
    Convenience: Date -> Excel-serial value via the active CalendarUtil.
    static Date
    excelToDate(double v)
    Convenience: Excel-serial value -> Date via the active CalendarUtil.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • dateToExcel

      public static double dateToExcel(Date d)
      Convenience: Date -> Excel-serial value via the active CalendarUtil.
    • excelToDate

      public static Date excelToDate(double v)
      Convenience: Excel-serial value -> Date via the active CalendarUtil.
    • calcToday

      public static double[] calcToday()
      [today 00:00, tomorrow 00:00).
    • calcTomorrow

      public static double[] calcTomorrow()
      [tomorrow 00:00, day-after-tomorrow 00:00).
    • calcYesterday

      public static double[] calcYesterday()
      [yesterday 00:00, today 00:00).
    • calcThisMonth

      public static double[] calcThisMonth()
      [start-of-this-month, start-of-next-month).
    • calcNextMonth

      public static double[] calcNextMonth()
      [start-of-next-month, start-of-month-after-that).
    • calcLastMonth

      public static double[] calcLastMonth()
      [start-of-last-month, start-of-this-month).
    • calcThisWeek

      public static double[] calcThisWeek()
      [start-of-this-week, start-of-next-week). Week boundary follows the locale's first day of week (Calendar.getFirstDayOfWeek()).
    • calcNextWeek

      public static double[] calcNextWeek()
      [start-of-next-week, start-of-week-after-that).
    • calcLastWeek

      public static double[] calcLastWeek()
      [start-of-last-week, start-of-this-week).
    • calcLast7Days

      public static double[] calcLast7Days()
      [today - 6, today + 1). 7-day window ending at today inclusive.
    • calcThisQuarter

      public static double[] calcThisQuarter()
      [start-of-this-quarter, start-of-next-quarter).
    • calcNextQuarter

      public static double[] calcNextQuarter()
      [start-of-next-quarter, start-of-quarter-after-that).
    • calcLastQuarter

      public static double[] calcLastQuarter()
      [start-of-last-quarter, start-of-this-quarter).
    • calcThisYear

      public static double[] calcThisYear()
      [Jan 1 of this year, Jan 1 of next year).
    • calcNextYear

      public static double[] calcNextYear()
      [Jan 1 of next year, Jan 1 of year after that).
    • calcLastYear

      public static double[] calcLastYear()
      [Jan 1 of last year, Jan 1 of this year).
    • calcYearToDate

      public static double[] calcYearToDate()
      [Jan 1 of this year, tomorrow 00:00). Year-to-date inclusive.