Klasse ChronoUnitUtils
java.lang.Object
com.flexganttfx.model.util.ChronoUnitUtils
A utility class providing methods used in combination with
ChronoUnit.-
Konstruktorübersicht
Konstruktoren -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungstatic LocalTimetruncate(LocalTime time, ChronoUnit unit, int stepRate) Truncates the given time for the given chrono unit.static ZonedDateTimetruncate(ZonedDateTime time, ChronoUnit unit, int stepRate, DayOfWeek firstDayOfWeek) Truncates the given time for the given chrono unit.
-
Konstruktordetails
-
ChronoUnitUtils
public ChronoUnitUtils()
-
-
Methodendetails
-
truncate
public static ZonedDateTime truncate(ZonedDateTime time, ChronoUnit unit, int stepRate, DayOfWeek firstDayOfWeek) Truncates the given time for the given chrono unit. The methodZonedDateTime.truncatedTo(java.time.temporal.TemporalUnit)is not sufficient as it only works for small units (hours, minutes, seconds). It does not work for any unit that has a variable duration (a month can be 28, 30, or 31 days long). We also want to be able to support a "step rate" (e.g. "truncate to minutes, to 5 minutes, to 15 minutes").- Parameter:
time- the time to truncateunit- the chrono unit on which the truncation will be basedstepRate- the step rate (1, 5, 15, ....)firstDayOfWeek- the first day of the week, needed for truncating weeks- Gibt zurück:
- the truncated time
-
truncate
Truncates the given time for the given chrono unit. The methodZonedDateTime.truncatedTo(java.time.temporal.TemporalUnit)is not sufficient as it only works for small units (hours, minutes, seconds). It does not work for any unit that has a variable duration (a month can be 28, 30, or 31 days long). We also want to be able to support a "step rate" (e.g. "truncate to minutes, to 5 minutes, to 15 minutes").- Parameter:
time- the time to truncateunit- the chrono unit on which the truncation will be basedstepRate- the step rate (1, 5, 15, ....)- Gibt zurück:
- the truncated time
-