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)
      Sets midnight of the year, month and date. Uses the system's time zone unless a different time zone is given.
      Parameters:
      year - Year
      month - Month (1 = January, 2 = February, ...)
      date - Day of month
      Returns:
      itself
    • 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. Uses the system's time zone unless a different time zone is given.
      Parameters:
      year - Year
      month - Month (1 = January, 2 = February, ...)
      date - Day of month
      hour - Hour of day
      minute - Minute
      second - Second
      Returns:
      itself
    • on

      T on(Calendar cal)
      Uses the given Calendar instance.
      Parameters:
      cal - Calendar. A copy of the date, time, and time zone is used. The Calendar instance may be reused after that.
      Returns:
      itself
    • on

      T on(Date date)
      Uses the given Date instance. Uses the system's time zone unless a different time zone is given.
      Parameters:
      date - Date. A copy of the date is used. The Date instance may be reused after that.
      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
      Since:
      2.2
    • today

      T 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

      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
    • timezone

      Sets the given TimeZone.
      Parameters:
      tz - TimeZone to be used.
      Returns:
      itself
    • timezone

      Sets the given TimeZone. This is a convenience method that just invokes TimeZone.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's TimeZone. This is the default.
      Returns:
      itself
    • utc

      T utc()
      Sets the time zone to UTC.
      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
      Since:
      2.8