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 TSets 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 Ton(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 givenInstantinstance.Uses the givenLocalDateinstance, and assumes midnight.on(LocalDateTime dateTime) Uses the givenLocalDateTimeinstance.on(ZonedDateTime dateTime) Uses the givenZonedDateTimeinstance.default TUses the givenCalendarinstance.default TUses the givenDateinstance.plusDays(int days) Adds a number of days to the current date.sameTimeAs(TimeParameter<?> t) Uses the same time as given in theTimeParameter.default TSets the given timezone.Sets the givenZoneId.default TSets theTimeZone.default Ttoday()Sets today, midnight.default Ttomorrow()Sets tomorrow, midnight.default Tutc()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 givenZonedDateTimeinstance.- Parameters:
dateTime-ZonedDateTimeto be used.- Returns:
- itself
-
on
Uses the givenLocalDateTimeinstance.- Parameters:
dateTime-LocalDateTimeto be used.- Returns:
- itself
-
on
Uses the givenLocalDateinstance, and assumes midnight.- Parameters:
date-LocalDateto be used.- Returns:
- itself
-
on
Uses the givenInstantinstance.- Parameters:
instant-Instantto be used.- Returns:
- itself
-
on
Uses the givenDateinstance.- Parameters:
date-Dateto be used.- Returns:
- itself
-
on
Uses the givenCalendarinstance.- Parameters:
cal-Calendarto 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-ZoneIdto 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-TimeZoneto 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-TimeParameterto be used.- Returns:
- itself
-