Interface TimeParameter<T>
- Type Parameters:
T
- Type of the final builder
- All Known Subinterfaces:
MoonIllumination.Parameters
,MoonPhase.Parameters
,MoonPosition.Parameters
,MoonTimes.Parameters
,SunPosition.Parameters
,SunTimes.Parameters
- All Known Implementing Classes:
BaseBuilder
public interface TimeParameter<T>
Time based parameters.
Use them to give information about the desired time. If ommitted, the current time and the system's time zone is used.
-
Method Summary
Modifier and TypeMethodDescriptiondefault T
Sets the system's timezone.midnight()
Sets the time to the start of the current date ("last midnight").now()
Sets the current date and time.default T
on
(int year, int month, int date) Sets midnight of the year, month and date.on
(int year, int month, int date, int hour, int minute, int second) Sets date and time.Uses the givenInstant
instance.Uses the givenLocalDate
instance, and assumes midnight.on
(LocalDateTime dateTime) Uses the givenLocalDateTime
instance.on
(ZonedDateTime dateTime) Uses the givenZonedDateTime
instance.default T
Uses the givenCalendar
instance.default T
Uses the givenDate
instance.plusDays
(int days) Adds a number of days to the current date.sameTimeAs
(TimeParameter<?> t) Uses the same time as given in theTimeParameter
.default T
Sets the given timezone.Sets the givenZoneId
.default T
Sets theTimeZone
.default T
today()
Sets today, midnight.default T
tomorrow()
Sets tomorrow, midnight.default T
utc()
Sets the time zone to UTC.
-
Method Details
-
on
Sets date and time. Note that also seconds can be passed in for convenience, but the results are not that accurate.- Parameters:
year
- Yearmonth
- Month (1 = January, 2 = February, ...)date
- Day of monthhour
- Hour of dayminute
- Minutesecond
- Second- Returns:
- itself
-
on
Sets midnight of the year, month and date.- Parameters:
year
- Yearmonth
- Month (1 = January, 2 = February, ...)date
- Day of month- Returns:
- itself
-
on
Uses the givenZonedDateTime
instance.- Parameters:
dateTime
-ZonedDateTime
to be used.- Returns:
- itself
-
on
Uses the givenLocalDateTime
instance.- Parameters:
dateTime
-LocalDateTime
to be used.- Returns:
- itself
-
on
Uses the givenLocalDate
instance, and assumes midnight.- Parameters:
date
-LocalDate
to be used.- Returns:
- itself
-
on
Uses the givenInstant
instance.- Parameters:
instant
-Instant
to be used.- Returns:
- itself
-
on
Uses the givenDate
instance.- Parameters:
date
-Date
to be used.- Returns:
- itself
-
on
Uses the givenCalendar
instance.- Parameters:
cal
-Calendar
to be used- Returns:
- itself
-
now
Sets the current date and time. This is the default.- Returns:
- itself
-
midnight
Sets the time to the start of the current date ("last midnight").- Returns:
- itself
-
plusDays
Adds a number of days to the current date.- Parameters:
days
- Number of days to add- Returns:
- itself
-
today
Sets today, midnight.It is the same as
now().midnight()
.- Returns:
- itself
-
tomorrow
Sets tomorrow, midnight.It is the same as
now().midnight().plusDays(1)
.- Returns:
- itself
-
timezone
Sets the givenZoneId
. The local time is retained, so the parameter order is not important.- Parameters:
tz
-ZoneId
to be used.- Returns:
- itself
-
timezone
Sets the given timezone. This is a convenience method that just invokesZoneId.of(String)
.- Parameters:
id
- ID of the time zone.- Returns:
- itself
- See Also:
-
localTime
Sets the system's timezone. This is the default.- Returns:
- itself
-
utc
Sets the time zone to UTC.- Returns:
- itself
-
timezone
Sets theTimeZone
.- Parameters:
tz
-TimeZone
to be used- Returns:
- itself
-
sameTimeAs
Uses the same time as given in theTimeParameter
.Changes to the source parameter will not affect this parameter, though.
- Parameters:
t
-TimeParameter
to be used.- Returns:
- itself
-