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:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(Date other)booleanequals(Object o)static 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.intgetDayOfMonth()Returns day of month between 1 and 31 inclusive.intgetMonth()Returns the month between 1 and 12 inclusive.intgetYear()Returns the year.inthashCode()static DateparseDate(String date)static DatetoJavaUtilDate(Date date)Convert a Google Date to a Java Util Date.StringtoString()
-
-
-
Method Detail
-
fromYearMonthDay
public static Date fromYearMonthDay(int year, int month, int dayOfMonth)
Constructs a new Date instance.- Parameters:
year- must be greater than 0month- 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.
-
compareTo
public int compareTo(Date other)
- Specified by:
compareToin interfaceComparable<Date>
-
-