Class DateTime


  • public class DateTime
    extends Object
    Date and time
    Author:
    osbornb
    • Constructor Detail

      • DateTime

        public DateTime()
        Constructor
      • DateTime

        public DateTime​(int year)
        Constructor
        Parameters:
        year - year
    • Method Detail

      • parse

        public static DateTime parse​(String text)
        Parse the text into a Date Time
        Parameters:
        text - date time text
        Returns:
        date time
      • tryParse

        public static DateTime tryParse​(String text)
        Attempt to parse the text into a Date Time
        Parameters:
        text - potential date time text
        Returns:
        date time or null
      • isOrdinal

        public boolean isOrdinal()
        Is an ordinal day
        Returns:
        true if ordinal day
      • hasTime

        public boolean hasTime()
        If date has a time precision
        Returns:
        true if has time
      • getYear

        public int getYear()
        Get the year
        Returns:
        year
      • setYear

        public void setYear​(int year)
        Set the year
        Parameters:
        year - year
      • getMonth

        public Integer getMonth()
        Get the month
        Returns:
        month
      • hasMonth

        public boolean hasMonth()
        Check if has a month
        Returns:
        true if has month
      • setMonth

        public void setMonth​(Integer month)
        Set the month
        Parameters:
        month - month
      • getDay

        public Integer getDay()
        Get the day
        Returns:
        day
      • hasDay

        public boolean hasDay()
        Check if has a day
        Returns:
        true if has day
      • setDay

        public void setDay​(Integer day)
        Set the day
        Parameters:
        day - day
      • getHour

        public Integer getHour()
        Get the hour
        Returns:
        hour
      • hasHour

        public boolean hasHour()
        Check if has a hour
        Returns:
        true if has hour
      • setHour

        public void setHour​(Integer hour)
        Set the hour
        Parameters:
        hour - hour
      • getMinute

        public Integer getMinute()
        Get the minute
        Returns:
        minute
      • hasMinute

        public boolean hasMinute()
        Check if has a minute
        Returns:
        true if has minute
      • setMinute

        public void setMinute​(Integer minute)
        Set the minute
        Parameters:
        minute - minute
      • getSecond

        public Integer getSecond()
        Get the second
        Returns:
        second
      • hasSecond

        public boolean hasSecond()
        Check if has a second
        Returns:
        true if has second
      • setSecond

        public void setSecond​(Integer second)
        Set the second
        Parameters:
        second - second
      • getFraction

        public Double getFraction()
        Get the fraction
        Returns:
        fraction
      • getFractionText

        public String getFractionText()
        Get the fraction text
        Returns:
        fraction text
        Since:
        1.1.0
      • hasFraction

        public boolean hasFraction()
        Check if has a fraction
        Returns:
        true if has fraction
      • setFraction

        public void setFraction​(Double fraction)
        Set the fraction
        Parameters:
        fraction - fraction
      • setFraction

        public void setFraction​(String fraction)
        Set the fraction
        Parameters:
        fraction - fraction
        Since:
        1.1.0
      • getTimeZoneHour

        public Integer getTimeZoneHour()
        Get the signed local time zone hour
        Returns:
        time zone hour (+ or -)
      • hasTimeZoneHour

        public boolean hasTimeZoneHour()
        Has a time zone hour
        Returns:
        true if has time zone hour
      • setTimeZoneHour

        public void setTimeZoneHour​(Integer timeZoneHour)
        Set the signed local time zone hour
        Parameters:
        timeZoneHour - time zone hour (+ or -)
      • getTimeZoneMinute

        public Integer getTimeZoneMinute()
        Get the local time zone minute
        Returns:
        time zone minute
      • hasTimeZoneMinute

        public boolean hasTimeZoneMinute()
        Has a time zone minute
        Returns:
        true if has time zone minute
      • setTimeZoneMinute

        public void setTimeZoneMinute​(Integer timeZoneMinute)
        Set the local time zone minute
        Parameters:
        timeZoneMinute - time zone minute
      • isTimeZoneUTC

        public boolean isTimeZoneUTC()
        Is the time zone UTC
        Returns:
        true if UTC
      • setTimeZoneUTC

        public void setTimeZoneUTC()
        Set the time zone as UTC
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object