Class Date (2.7.1)
Version 2.7.1keyboard_arrow_down
public final class Date implements Comparable<Date> , Serializable
Represents a Date without time, such as 2017-03-17. Date is timezone independent.
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
parseDate(String date)
public static Date parseDate ( String date )
Parameter
Name
Description
date
String Data in RFC 3339 date format (yyyy-mm-dd).
Returns
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
equals(Object o)
public boolean equals ( Object o )
Parameter
Returns
Overrides
getDayOfMonth()
public int getDayOfMonth ()
Returns day of month between 1 and 31 inclusive.
Returns
getMonth()
Returns the month between 1 and 12 inclusive.
Returns
getYear()
Returns
hashCode()
Returns
Overrides
toString()
Returns
Overrides
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License , and code samples are licensed under the Apache 2.0 License . For details, see the Google Developers Site Policies . Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2026-01-24 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2026-01-24 UTC."],[],[]]