Class ZonedDateTimeBuilder


  • public class ZonedDateTimeBuilder
    extends java.lang.Object
    This is basically a Calendar.Builder replacement that builds Java 8 ZonedDateTime instances.
    Author:
    Seth
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.time.ZonedDateTime build()
      Build the ZonedDateTime instance.
      protected java.time.ZoneId getBestZoneId()
      Return the specified ZoneId or ZoneId.systemDefault() if none has been specified.
      java.lang.Integer getDayOfMonth()  
      java.lang.Integer getHourOfDay()  
      java.lang.Integer getMinute()  
      java.lang.Integer getMonth()  
      java.lang.Integer getNanosecond()  
      java.lang.Integer getSecond()  
      java.lang.Integer getYear()  
      java.time.ZoneId getZoneId()  
      static java.time.ZoneId parseZoneId​(java.lang.String value)
      Convert a time zone String into a ZoneId.
      void setDayOfMonth​(java.lang.Integer dayOfMonth)  
      void setHourOfDay​(java.lang.Integer hourOfDay)  
      void setMinute​(java.lang.Integer minute)  
      void setMonth​(java.lang.Integer month)  
      void setNanosecond​(java.lang.Integer nanosecond)  
      void setSecond​(java.lang.Integer second)  
      void setYear​(java.lang.Integer year)  
      void setZoneId​(java.time.ZoneId timeZone)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ZonedDateTimeBuilder

        public ZonedDateTimeBuilder()
    • Method Detail

      • parseZoneId

        public static java.time.ZoneId parseZoneId​(java.lang.String value)
        Convert a time zone String into a ZoneId. This will work with all standard ZoneId types, plus a mostly-exhaustive list of 3-letter offset abbreviations.
      • getYear

        public java.lang.Integer getYear()
      • setYear

        public void setYear​(java.lang.Integer year)
      • getMonth

        public java.lang.Integer getMonth()
      • setMonth

        public void setMonth​(java.lang.Integer month)
      • getDayOfMonth

        public java.lang.Integer getDayOfMonth()
      • setDayOfMonth

        public void setDayOfMonth​(java.lang.Integer dayOfMonth)
      • getHourOfDay

        public java.lang.Integer getHourOfDay()
      • setHourOfDay

        public void setHourOfDay​(java.lang.Integer hourOfDay)
      • getMinute

        public java.lang.Integer getMinute()
      • setMinute

        public void setMinute​(java.lang.Integer minute)
      • getSecond

        public java.lang.Integer getSecond()
      • setSecond

        public void setSecond​(java.lang.Integer second)
      • getNanosecond

        public java.lang.Integer getNanosecond()
      • setNanosecond

        public void setNanosecond​(java.lang.Integer nanosecond)
      • getZoneId

        public java.time.ZoneId getZoneId()
      • setZoneId

        public void setZoneId​(java.time.ZoneId timeZone)
      • build

        public java.time.ZonedDateTime build()
        Build the ZonedDateTime instance. The following fields are required to generate a datestamp:
        • month
        • dayOfMonth

        If missing:

        • year will be assumed to be within the last 12 months or slightly in the future (if the current month is December)
        • hourOfDay, minute, second and nanosecond will be assumed to be zero
        • time zone will be assumed to be the system time zone (ZoneId.systemDefault())
        Returns:
      • getBestZoneId

        protected java.time.ZoneId getBestZoneId()
        Return the specified ZoneId or ZoneId.systemDefault() if none has been specified.
        Returns: