Class Date

java.lang.Object
com.google.cloud.Date
All Implemented Interfaces:
Serializable, Comparable<Date>

@BetaApi("This is going to be replaced with LocalDate from threetenbp") public final class Date extends Object implements Comparable<Date>, Serializable
Represents a Date without time, such as 2017-03-17. Date is timezone independent.
See Also:
  • Method Details

    • fromYearMonthDay

      public static Date fromYearMonthDay(int year, int month, int dayOfMonth)
      Constructs a new Date instance.
      Parameters:
      year - must be greater than 0
      month - must be between [1,12]
      dayOfMonth - must be between [1,31]
    • parseDate

      public static Date parseDate(String date)
      Parameters:
      date - Data in RFC 3339 date format (yyyy-mm-dd).
    • toJavaUtilDate

      public static Date toJavaUtilDate(Date date)
      Convert a Google Date to a Java Util Date.
      Parameters:
      date - the date of the Google Date.
      Returns:
      java.util.Date
    • fromJavaUtilDate

      public static Date fromJavaUtilDate(Date date)
      Convert a Java Util Date to a Google Date.
      Parameters:
      date - the date of the java.util.Date
      Returns:
      Google Java Date
    • getYear

      public int getYear()
      Returns the year.
    • getMonth

      public int getMonth()
      Returns the month between 1 and 12 inclusive.
    • getDayOfMonth

      public int getDayOfMonth()
      Returns day of month between 1 and 31 inclusive.
    • toString

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

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

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

      public int compareTo(Date other)
      Specified by:
      compareTo in interface Comparable<Date>