Package org.joda.time

Interface ReadableDateTime

  • All Superinterfaces:
    java.lang.Comparable<ReadableInstant>, ReadableInstant
    All Known Subinterfaces:
    ReadWritableDateTime
    All Known Implementing Classes:
    AbstractDateTime, BaseDateTime, DateMidnight, DateTime, MutableDateTime

    public interface ReadableDateTime
    extends ReadableInstant
    Defines an instant in time that can be queried using datetime fields.

    The implementation of this interface may be mutable or immutable. This interface only gives access to retrieve data, never to change it.

    Methods in your application should be defined using ReadableDateTime as a parameter if the method only wants to read the datetime, and not perform any advanced manipulations.

    Since:
    1.0
    • Method Detail

      • getDayOfWeek

        int getDayOfWeek()
        Get the day of week field value.

        The values for the day of week are defined in DateTimeConstants.

        Returns:
        the day of week
      • getDayOfMonth

        int getDayOfMonth()
        Get the day of month field value.
        Returns:
        the day of month
      • getDayOfYear

        int getDayOfYear()
        Get the day of year field value.
        Returns:
        the day of year
      • getWeekOfWeekyear

        int getWeekOfWeekyear()
        Get the week of weekyear field value.

        This field is associated with the "weekyear" via getWeekyear(). In the standard ISO8601 week algorithm, the first week of the year is that in which at least 4 days are in the year. As a result of this definition, day 1 of the first week may be in the previous year.

        Returns:
        the week of a week based year
      • getWeekyear

        int getWeekyear()
        Get the weekyear field value.

        The weekyear is the year that matches with the weekOfWeekyear field. In the standard ISO8601 week algorithm, the first week of the year is that in which at least 4 days are in the year. As a result of this definition, day 1 of the first week may be in the previous year. The weekyear allows you to query the effective year for that day.

        Returns:
        the year of a week based year
      • getMonthOfYear

        int getMonthOfYear()
        Get the month of year field value.
        Returns:
        the month of year
      • getYear

        int getYear()
        Get the year field value.
        Returns:
        the year
      • getYearOfEra

        int getYearOfEra()
        Get the year of era field value.
        Returns:
        the year of era
      • getYearOfCentury

        int getYearOfCentury()
        Get the year of century field value.
        Returns:
        the year of century
      • getCenturyOfEra

        int getCenturyOfEra()
        Get the year of era field value.
        Returns:
        the year of era
      • getEra

        int getEra()
        Get the era field value.
        Returns:
        the era
      • getMillisOfSecond

        int getMillisOfSecond()
        Get the millis of second field value.
        Returns:
        the millis of second
      • getMillisOfDay

        int getMillisOfDay()
        Get the millis of day field value.
        Returns:
        the millis of day
      • getSecondOfMinute

        int getSecondOfMinute()
        Get the second of minute field value.
        Returns:
        the second of minute
      • getSecondOfDay

        int getSecondOfDay()
        Get the second of day field value.
        Returns:
        the second of day
      • getMinuteOfHour

        int getMinuteOfHour()
        Get the minute of hour field value.
        Returns:
        the minute of hour
      • getMinuteOfDay

        int getMinuteOfDay()
        Get the minute of day field value.
        Returns:
        the minute of day
      • getHourOfDay

        int getHourOfDay()
        Get the hour of day field value.
        Returns:
        the hour of day
      • toDateTime

        DateTime toDateTime()
        Get this object as a DateTime.

        If the implementation of the interface is a DateTime, it is returned directly.

        Returns:
        a DateTime using the same millis
      • toMutableDateTime

        MutableDateTime toMutableDateTime()
        Get this object as a MutableDateTime, always returning a new instance.
        Returns:
        a MutableDateTime using the same millis
      • toString

        java.lang.String toString​(java.lang.String pattern)
                           throws java.lang.IllegalArgumentException
        Output the instant using the specified format pattern.
        Parameters:
        pattern - pattern specification
        Throws:
        java.lang.IllegalArgumentException - if pattern is invalid
        See Also:
        DateTimeFormat
      • toString

        java.lang.String toString​(java.lang.String pattern,
                                  java.util.Locale locale)
                           throws java.lang.IllegalArgumentException
        Output the instant using the specified format pattern.
        Parameters:
        pattern - pattern specification
        locale - Locale to use, or null for default
        Throws:
        java.lang.IllegalArgumentException - if pattern is invalid
        See Also:
        DateTimeFormat