Class Date (2.43.0)
Stay organized with collections
Save and categorize content based on your preferences.
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 |
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
|
Overrides
getDayOfMonth()
public int getDayOfMonth()
Returns day of month between 1 and 31 inclusive.
Returns |
Type |
Description |
int |
|
getMonth()
Returns the month between 1 and 12 inclusive.
Returns |
Type |
Description |
int |
|
getYear()
Returns |
Type |
Description |
int |
|
hashCode()
Returns |
Type |
Description |
int |
|
Overrides
toString()
Returns |
Type |
Description |
String |
|
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 2024-10-03 UTC.
[{
"type": "thumb-down",
"id": "hardToUnderstand",
"label":"Hard to understand"
},{
"type": "thumb-down",
"id": "incorrectInformationOrSampleCode",
"label":"Incorrect information or sample code"
},{
"type": "thumb-down",
"id": "missingTheInformationSamplesINeed",
"label":"Missing the information/samples I need"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"Other"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"Easy to understand"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"Solved my problem"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"Other"
}]
{"lastModified": "Last updated 2024-10-03 UTC."}
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-10-03 UTC."]]