public class Date extends Object implements Comparable<Date>
DateUtil
,
DateOption
Modifier and Type | Class and Description |
---|---|
static class |
Date.Format
Represents kinds of date formats.
|
Modifier and Type | Field and Description |
---|---|
static String |
FORMAT
The default date format.
|
Constructor and Description |
---|
Date()
Creates a new instance which represents
0001/01/01 (YYYY/MM/DD) . |
Date(int elapsedDays)
Creates a new instance.
|
Date(int year,
int month,
int day)
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(Date o) |
boolean |
equals(Object obj) |
int |
getDay()
Returns the day of this date.
|
int |
getElapsedDays()
Returns the number of elapsed days from
0001/01/01 (YYYY/MM/DD) . |
int |
getMonth()
Returns the month of this date.
|
int |
getYear()
Returns the year of this date.
|
int |
hashCode() |
void |
setElapsedDays(int elapsed)
Sets the date as number of elapsed days from
0001/01/01 . |
String |
toString() |
static Date |
valueOf(String dateString,
Date.Format format)
Parses the target string and returns the corresponding date object.
|
static Date |
valueOf(StringOption dateString,
Date.Format format)
Parses the target string and returns the corresponding date as the elapsed days from
0001/01/01 (YYYY/MM/DD) . |
public static final String FORMAT
public Date()
0001/01/01 (YYYY/MM/DD)
.public Date(int year, int month, int day)
year
- year (1-...)month
- month (1-12)day
- day (1-31)public Date(int elapsedDays)
elapsedDays
- the number of elapsed days from 0001/01/01 (YYYY/MM/DD)
(0-origin)public int getElapsedDays()
0001/01/01 (YYYY/MM/DD)
.public void setElapsedDays(int elapsed)
0001/01/01
.elapsed
- the elapsed days (0-origin)public int getYear()
public int getMonth()
public int getDay()
public int compareTo(Date o)
compareTo
in interface Comparable<Date>
public static Date valueOf(StringOption dateString, Date.Format format)
0001/01/01 (YYYY/MM/DD)
.dateString
- the target stringformat
- the format kindIllegalArgumentException
- if the target string is malformedpublic static Date valueOf(String dateString, Date.Format format)
dateString
- the target stringformat
- the format kindIllegalArgumentException
- if the target string is malformedCopyright © 2011–2019 Asakusa Framework Team. All rights reserved.