Class Weeks

All Implemented Interfaces:
Serializable, Comparable<Weeks>, TimeSpan<CalendarUnit>

public final class Weeks extends SingleUnitTimeSpan<CalendarUnit,​Weeks>

Represents a time span in 7-day weeks.

Since:
3.21/4.17
Author:
Meno Hochschild
See Also:
Serialized Form
  • Field Details

    • ZERO

      public static final Weeks ZERO

      Constant for zero weeks.

    • ONE

      public static final Weeks ONE

      Constant for exactly one week.

  • Method Details

    • of

      public static Weeks of(int weeks)

      Obtains a time span in given weeks.

      Parameters:
      weeks - count of weeks, maybe negative
      Returns:
      time span in weeks
      See Also:
      CalendarUnit.WEEKS
    • between

      public static <T extends TimePoint<? super CalendarUnit,​ T>> Weeks between(T t1, T t2)

      Determines the temporal distance between given dates/time-points in weeks.

      Type Parameters:
      T - generic type of time-points
      Parameters:
      t1 - first time-point
      t2 - second time-point
      Returns:
      result of week difference
      See Also:
      PlainDate, PlainTimestamp
    • between

      public static Weeks between(CalendarWeek w1, CalendarWeek w2)

      Determines the difference in weeks between given quarter years.

      Parameters:
      w1 - first calendar week
      w2 - second calendar week
      Returns:
      difference in weeks
    • parsePeriod

      public static Weeks parsePeriod(String period) throws ParseException

      Parses the canonical ISO-8601-format "PnW" with possible preceding minus-char.

      Parameters:
      period - the formatted string to be parsed
      Returns:
      parsed instance
      Throws:
      ParseException - if given argument cannot be parsed