public class DateTime
extends java.lang.Object
DateTime
represents a date.
It can be constructed by the following ways.
Example:
DateTime date = new DateTime(); or DateTime date = new DateTime(1970, 1, 1, 0, 0, 0, 0);.
Constructor and Description |
---|
DateTime()
Construct a
DateTime object by the default way. |
DateTime(short year,
short month,
short day,
short hour,
short minute,
short second,
short mill)
Construct a
DateTime object with the specified year,month,day,hour,minute,second
and millisecond. |
Modifier and Type | Method and Description |
---|---|
short |
getDay()
Get the day of the date, from 1 to 31.
|
short |
getHour()
Get the hour of the date, from 0 to 23.
|
short |
getMilliseconds()
Get the millisecond of the date.
|
short |
getMinute()
Get the minute of the date, from 0 to 59.
|
short |
getMonth()
Get the month of the date, from 1 to 12.
|
short |
getSecond()
Get the second of the date, from 0 to 60.
|
short |
getTimeZoneHour()
Get the hour of time zone of the date.
|
short |
getTimeZoneMinute()
Get the minute of time zone of the date, from 0 to 59.
|
short |
getYear()
Get the year of the date.
|
void |
setDay(short day)
Set the day for the date, from 1 to 31.
|
void |
setHour(short hour)
Set the hour for the date, from 0 to 23.
|
void |
setMilliseconds(short mill)
Set the millisecond for the date.
|
void |
setMinute(short minute)
Set the minute for the date, from 0 to 59.
|
void |
setMonth(short month)
Set the month for the date, from 1 to 12.
|
void |
setSecond(short second)
Set the second for the date, from 0 to 60.
|
void |
setTimeZoneHour(short hour)
Set the time zone of the date.
|
void |
setTimeZoneMinute(short minute)
Set the minute of time zone of the date, from 0 to 59.
|
void |
setYear(short year)
Set the year for the date.
|
public DateTime()
DateTime
object by the default way. The default date
will be:1970/1/1 00:00::00.public DateTime(short year, short month, short day, short hour, short minute, short second, short mill)
DateTime
object with the specified year,month,day,hour,minute,second
and millisecond.year
- The year.month
- The month.day
- The day in the month.hour
- The hour.minute
- The minute.second
- The second.mill
- The millisecond.public void setYear(short year)
year
- The specified year.public void setMonth(short month)
month
- The specified month.public void setDay(short day)
day
- The specified day.public void setHour(short hour)
hour
- The specified hour.public void setMinute(short minute)
minute
- The specified minute.public void setSecond(short second)
second
- The specified second.public void setMilliseconds(short mill)
mill
- The specified millisecond.public short getYear()
public short getMonth()
public short getDay()
public short getHour()
public short getMinute()
public short getSecond()
public short getMilliseconds()
public void setTimeZoneHour(short hour)
hour
- The specified time zone hour.public short getTimeZoneHour()
public void setTimeZoneMinute(short minute)
minute
- The specified time zone minute.public short getTimeZoneMinute()