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 TypeMethodDescriptionSets the system'sTimeZone
.midnight()
Sets the time to the start of the current date ("last midnight").now()
Sets the current date and time.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 givenCalendar
instance.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
.Sets the givenTimeZone
.Sets the givenTimeZone
.today()
Sets today, midnight.tomorrow()
Sets tomorrow, midnight.utc()
Sets the time zone to UTC.
-
Method Details
-
on
Sets midnight of the year, month and date. Uses the system's time zone unless a different time zone is given.- Parameters:
year
- Yearmonth
- Month (1 = January, 2 = February, ...)date
- Day of month- Returns:
- itself
-
on
Sets date and time. Note that also seconds can be passed in for convenience, but the results are not that accurate. Uses the system's time zone unless a different time zone is given.- Parameters:
year
- Yearmonth
- Month (1 = January, 2 = February, ...)date
- Day of monthhour
- Hour of dayminute
- Minutesecond
- Second- Returns:
- itself
-
on
Uses the givenCalendar
instance. -
on
Uses the givenDate
instance. Uses the system's time zone unless a different time zone is given. -
plusDays
Adds a number of days to the current date.- Parameters:
days
- Number of days to add- Returns:
- itself
- Since:
- 2.2
-
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
- Since:
- 2.2
-
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
-
timezone
Sets the givenTimeZone
.- Parameters:
tz
-TimeZone
to be used.- Returns:
- itself
-
timezone
Sets the givenTimeZone
. This is a convenience method that just invokesTimeZone.getTimeZone(String)
.- Parameters:
id
- ID of the time zone. "GMT" is used if the time zone ID was not understood.- Returns:
- itself
- See Also:
-
localTime
Sets the system'sTimeZone
. This is the default.- Returns:
- itself
-
utc
Sets the time zone to UTC.- 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
- Since:
- 2.8
-