Class Weekcycle
- All Implemented Interfaces:
Serializable
,ChronoUnit
,IsoDateUnit
,IsoUnit
Represents a special unit for week-based years which are described by ISO-8601 and follow the week cycle from Monday to Sunday.
- Since:
- 3.21/4.17
- Author:
- Meno Hochschild
- See Also:
- Serialized Form
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionlong
Calculates the temporal distance between given calendar dates in this calendar unit.double
Defines the typical length of this time unit in seconds without taking into account anomalies like timezone effects or leap seconds.char
Gets the format symbol which is used to display this time unit in canonical representations of timespans.boolean
Queries if this time unit is calendrical respective is at least as long as a calendar day.toString()
-
Field Details
-
YEARS
Constant for week-based years which either have 364 or 371 days.
-
-
Method Details
-
between
Calculates the temporal distance between given calendar dates in this calendar unit.
- Parameters:
start
- starting dateend
- ending date- Returns:
- duration as count of this unit
-
getSymbol
public char getSymbol()Description copied from interface:IsoUnit
Gets the format symbol which is used to display this time unit in canonical representations of timespans.
Canonical timespan formats follow ISO-8601. For example, the day unit is represented by the symbol D. Note that the letters P and T must not be used because these special characters are for structuring, the display. In ISO-8601 following symbols are defined:
- Y - year
- M - month or minute
- W - week
- D - day
- H - hour
- S - second
- P - qualifies a timespan (period)
- T - separates date and time part
If this method yields as special case a digit 1-9 then Time4J expects a fractional display of preceding second unit S that is nanoseconds, microseconds and milliseconds. Time4J will use the comma as decimal separation char in the canonical display as recommended by ISO-8601 unless the system property "net.time4j.format.iso.decimal.dot" is set to
true
(which causes the usage of a dot).- Specified by:
getSymbol
in interfaceIsoUnit
- Returns:
- char (ASCII-NULL if undefined)
- See Also:
Duration.toString()
-
getLength
public double getLength()Description copied from interface:ChronoUnit
Defines the typical length of this time unit in seconds without taking into account anomalies like timezone effects or leap seconds.
Important note: This method can only yield an estimated value and is not intended to assist in calculations of durations, but only in sorting of units.
- Specified by:
getLength
in interfaceChronoUnit
- Returns:
- estimated decimal value in seconds
-
isCalendrical
public boolean isCalendrical()Description copied from interface:ChronoUnit
Queries if this time unit is calendrical respective is at least as long as a calendar day.
Implementation note: The method must be consistent with the typical length of the unit. The expression
Double.compare(unit.getLength(), 86400.0) >= 0
is equivalent tounit.isCalendrical()
.- Specified by:
isCalendrical
in interfaceChronoUnit
- Returns:
true
if at least as long as a day elsefalse
-
toString
-