Class Date (2.39.0)

public final class Date implements Comparable<Date>, Serializable

Represents a Date without time, such as 2017-03-17. Date is timezone independent.

Inheritance

Object > Date

Static Methods

fromJavaUtilDate(Date date)

public static Date fromJavaUtilDate(Date date)

Convert a Java Util Date to a Google Date.

Parameter
Name Description
date Date

the date of the java.util.Date

Returns
Type Description
Date

Google Java Date

fromYearMonthDay(int year, int month, int dayOfMonth)

public static Date fromYearMonthDay(int year, int month, int dayOfMonth)

Constructs a new Date instance.

Parameters
Name Description
year int

must be greater than 0

month int

must be between [1,12]

dayOfMonth int

must be between [1,31]

Returns
Type Description
Date

parseDate(String date)

public static Date parseDate(String date)
Parameter
Name Description
date String

Data in RFC 3339 date format (yyyy-mm-dd).

Returns
Type Description
Date

toJavaUtilDate(Date date)

public static Date toJavaUtilDate(Date date)

Convert a Google Date to a Java Util Date.

Parameter
Name Description
date Date

the date of the Google Date.

Returns
Type Description
Date

java.util.Date

Methods

compareTo(Date other)

public int compareTo(Date other)
Parameter
Name Description
other Date
Returns
Type Description
int

equals(Object o)

public boolean equals(Object o)
Parameter
Name Description
o Object
Returns
Type Description
boolean
Overrides

getDayOfMonth()

public int getDayOfMonth()

Returns day of month between 1 and 31 inclusive.

Returns
Type Description
int

getMonth()

public int getMonth()

Returns the month between 1 and 12 inclusive.

Returns
Type Description
int

getYear()

public int getYear()

Returns the year.

Returns
Type Description
int

hashCode()

public int hashCode()
Returns
Type Description
int
Overrides

toString()

public String toString()
Returns
Type Description
String
Overrides