public class DateTime extends Object implements Comparable<DateTime>
DateUtil
,
DateTimeOption
Modifier and Type | Class and Description |
---|---|
static class |
DateTime.Format
Represents kinds of date and time formats.
|
Modifier and Type | Field and Description |
---|---|
static String |
FORMAT
The default date and time format.
|
Constructor and Description |
---|
DateTime()
Creates a new instance which represents
0001/01/01 (YYYY/MM/DD) 00:00:00 . |
DateTime(int year,
int month,
int day,
int hour,
int minute,
int second)
Creates a new instance.
|
DateTime(long elapsedSeconds)
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(DateTime o) |
boolean |
equals(Object obj) |
int |
getDay()
Returns the day of this date and time.
|
long |
getElapsedSeconds()
Returns the number of elapsed seconds from
0001/01/01 (YYYY/MM/DD) 00:00:00 . |
int |
getHour()
Returns the hour of this date time.
|
int |
getMinute()
Returns the minute of this date time.
|
int |
getMonth()
Returns the month of this date and time.
|
int |
getSecond()
Returns the second of this date time.
|
int |
getYear()
Returns the year of this date and time.
|
int |
hashCode() |
void |
setElapsedSeconds(long elapsed)
Sets the date and time as number of elapsed seconds from
0001/01/01 (YYYY/MM/DD) 00:00:00 . |
String |
toString() |
static DateTime |
valueOf(String timeString,
DateTime.Format format)
Parses the target string using the specified format, and returns the corresponding date and time object.
|
static DateTime |
valueOf(StringOption timeString,
DateTime.Format format)
Parses the target string using the specified format, and returns the corresponding date and time as the elapsed
seconds from
0001/01/01 (YYYY/MM/DD) 00:00:00 . |
public static final String FORMAT
public DateTime()
0001/01/01 (YYYY/MM/DD) 00:00:00
.public DateTime(long elapsedSeconds)
elapsedSeconds
- the number of elapsed seconds from 0001/01/01 (YYYY/MM/DD) 00:00:00
(0-origin)public DateTime(int year, int month, int day, int hour, int minute, int second)
year
- year (1-...)month
- month (1-12)day
- day (1-31)hour
- hour (0-23)minute
- minute (0-59)second
- second (0-59)public long getElapsedSeconds()
0001/01/01 (YYYY/MM/DD) 00:00:00
.public void setElapsedSeconds(long elapsed)
0001/01/01 (YYYY/MM/DD) 00:00:00
.elapsed
- the elapsed seconds (0-origin)public int getYear()
public int getMonth()
public int getDay()
public int getHour()
public int getMinute()
public int getSecond()
public int compareTo(DateTime o)
compareTo
in interface Comparable<DateTime>
public static DateTime valueOf(StringOption timeString, DateTime.Format format)
0001/01/01 (YYYY/MM/DD) 00:00:00
.timeString
- the target stringformat
- the format kindIllegalArgumentException
- if the target string is malformedpublic static DateTime valueOf(String timeString, DateTime.Format format)
timeString
- the target stringformat
- the format kindIllegalArgumentException
- if the target string is malformedCopyright © 2011–2018 Asakusa Framework Team. All rights reserved.