Class LocalDay

java.lang.Object
appointmentplanner.api.LocalDay

public class LocalDay extends Object
Utility class to do zoned time conversion.
Author:
Pieter van den Hombergh p.vandenhombergh@fontys.nl
  • Constructor Details

    • LocalDay

      public LocalDay(ZoneId zone, LocalDate date)
      Create a local day in the given timezone at the given date.
      Parameters:
      zone - the timezone to use
      date - the LocalDate to use
    • LocalDay

      public LocalDay()
      Create a LocalDay based on the system default timezone and the current date.
  • Method Details

    • getDate

      public LocalDate getDate()
      Get the date.
      Returns:
      the date
    • getZone

      public ZoneId getZone()
      Get the timezone identifier.
      Returns:
      timezone identifier
    • ofLocalTime

      public Instant ofLocalTime(LocalTime localTime)
      Get the time as instant.
      Parameters:
      localTime - the local time
      Returns:
      the time as an instant at this date and timezone
    • timeOfInstant

      public LocalTime timeOfInstant(Instant instant)
      Get the LocalTime of an instant according to this day.
      Parameters:
      instant - to convert to LocalTime
      Returns:
      the LocalTime of the given instant
    • dateOfInstant

      public LocalDate dateOfInstant(Instant instant)
      Get the LocalDate of an instant according to this timezone.
      Parameters:
      instant - to convert to LocalDate
      Returns:
      the LocalDate of the given instant
    • plusDays

      public LocalDay plusDays(int days)
      Add x numbers of days to this LocalDay.
      Parameters:
      days - to add
      Returns:
      the new LocalDay shifted forward or backward in time.
    • at

      public Instant at(int hm, int m)
      Get the instant at the given hours and minutes.
      Parameters:
      hm - the hours
      m - the minutes
      Returns:
      Instant at the given ours and minutes
    • now

      public static LocalDay now()
      Return the LocalDay for the default time zone at the current date.
      Returns:
      the day
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object