Package com.google.cloud
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 Summary
Modifier and TypeMethodDescriptionintbooleanstatic DatefromJavaUtilDate(Date date) Convert a Java Util Date to a Google Date.static DatefromYearMonthDay(int year, int month, int dayOfMonth) Constructs a new Date instance.intReturns day of month between 1 and 31 inclusive.intgetMonth()Returns the month between 1 and 12 inclusive.intgetYear()Returns the year.inthashCode()static Datestatic DatetoJavaUtilDate(Date date) Convert a Google Date to a Java Util Date.toString()
-
Method Details
-
fromYearMonthDay
Constructs a new Date instance.- Parameters:
year- must be greater than 0month- must be between [1,12]dayOfMonth- must be between [1,31]
-
parseDate
- Parameters:
date- Data in RFC 3339 date format (yyyy-mm-dd).
-
toJavaUtilDate
Convert a Google Date to a Java Util Date.- Parameters:
date- the date of the Google Date.- Returns:
- java.util.Date
-
fromJavaUtilDate
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
-
equals
-
hashCode
public int hashCode() -
compareTo
- Specified by:
compareToin interfaceComparable<Date>
-