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 Details

    • on

      T on(int year, int month, int date, int hour, int minute, int second)
      Sets date and time. Note that also seconds can be passed in for convenience, but the results are not that accurate.
      Parameters:
      year - Year
      month - Month (1 = January, 2 = February, ...)
      date - Day of month
      hour - Hour of day
      minute - Minute
      second - Second
      Returns:
      itself
    • on

      default T on(int year, int month, int date)
      Sets midnight of the year, month and date.
      Parameters:
      year - Year
      month - Month (1 = January, 2 = February, ...)
      date - Day of month
      Returns:
      itself
    • on

      T on(ZonedDateTime dateTime)
      Uses the given ZonedDateTime instance.
      Parameters:
      dateTime - ZonedDateTime to be used.
      Returns:
      itself
    • on

      T on(LocalDateTime dateTime)
      Uses the given LocalDateTime instance.
      Parameters:
      dateTime - LocalDateTime to be used.
      Returns:
      itself
    • on

      T on(LocalDate date)
      Uses the given LocalDate instance, and assumes midnight.
      Parameters:
      date - LocalDate to be used.
      Returns:
      itself
    • on

      T on(Instant instant)
      Uses the given Instant instance.
      Parameters:
      instant - Instant to be used.
      Returns:
      itself
    • on

      default T on(Date date)
      Uses the given Date instance.
      Parameters:
      date - Date to be used.
      Returns:
      itself
    • on

      default T on(Calendar cal)
      Uses the given Calendar instance.
      Parameters:
      cal - Calendar to be used
      Returns:
      itself
    • now

      T 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

      T plusDays(int days)
      Adds a number of days to the current date.
      Parameters:
      days - Number of days to add
      Returns:
      itself
    • today

      default T today()
      Sets today, midnight.

      It is the same as now().midnight().

      Returns:
      itself
    • tomorrow

      default T tomorrow()
      Sets tomorrow, midnight.

      It is the same as now().midnight().plusDays(1).

      Returns:
      itself
    • timezone

      Sets the given ZoneId. The local time is retained, so the parameter order is not important.
      Parameters:
      tz - ZoneId to be used.
      Returns:
      itself
    • timezone

      default T timezone(String id)
      Sets the given timezone. This is a convenience method that just invokes ZoneId.of(String).
      Parameters:
      id - ID of the time zone.
      Returns:
      itself
      See Also:
    • localTime

      default T localTime()
      Sets the system's timezone. This is the default.
      Returns:
      itself
    • utc

      default T utc()
      Sets the time zone to UTC.
      Returns:
      itself
    • timezone

      default T timezone(TimeZone tz)
      Sets the TimeZone.
      Parameters:
      tz - TimeZone to be used
      Returns:
      itself
    • sameTimeAs

      Uses the same time as given in the TimeParameter.

      Changes to the source parameter will not affect this parameter, though.

      Parameters:
      t - TimeParameter to be used.
      Returns:
      itself