public class DateTime extends java.lang.Object implements IDate, java.lang.Comparable<DateTime>, java.lang.Cloneable, java.io.Serializable
Date.Formatter.format(DateTime),
DateFormat.format(DateTime),
Serialized Form| Constructor and Description |
|---|
DateTime() |
DateTime(int year,
int month,
int date)
Constructs a
DateTime with zero in the time fields (HMS). |
DateTime(int year,
int month,
int date,
int hours,
int minutes)
Constructs a
DateTime with zero in the time fields (HMS). |
DateTime(int year,
int month,
int date,
int hours,
int minutes,
int seconds)
Constructs a
DateTime with zero in the time fields (HMS). |
DateTime(int year,
int month,
int date,
int hours,
int minutes,
int seconds,
int millis)
Constructs a
DateTime with all its fields initialized. |
| Modifier and Type | Method and Description |
|---|---|
DateTime |
add(long elapsed)
Adds the given number of milliseconds to this date time object
|
boolean |
after(DateTime dt) |
boolean |
afterOrEquals(DateTime dt) |
boolean |
before(DateTime dt) |
boolean |
beforeOrEquals(DateTime dt) |
int |
compareTo(DateTime dt) |
DateTime |
decDate() |
DateTime |
decMonth() |
DateTime |
decYear() |
DateTime |
duplicate()
Makes a copy of this instance.
|
boolean |
equals(java.lang.Object obj) |
int |
getDate() |
int |
getHours() |
int |
getMilliseconds() |
int |
getMinutes() |
int |
getMonth() |
int |
getSeconds() |
int |
getYear() |
int |
hashCode() |
DateTime |
incDate() |
DateTime |
incMonth() |
DateTime |
incYear() |
boolean |
isSameDay(DateTime dt) |
void |
setDate(int date)
Sets the day of the month.
|
void |
setHMSM(int hours,
int minutes,
int seconds,
int milliseconds)
Sets only the time part (H=hours, M=minutes, S=seconds, M=milliseconds) without changing the date part (YMD)
|
void |
setHours(int hours) |
void |
setMilliseconds(int milliseconds) |
void |
setMinutes(int minutes) |
void |
setMonth(int month) |
void |
setSeconds(int seconds) |
void |
setYear(int year) |
void |
setYMD(int year,
int month,
int date)
Sets only the date part (Y=year, M=month, D=date (day of month)) without change the time part (HMS)
|
java.lang.String |
toString() |
public DateTime()
public DateTime(int year,
int month,
int date)
DateTime with zero in the time fields (HMS).month - it must be between 0 and 11 (same as Date)date - it must be between 1 and 31 (same as Date)public DateTime(int year,
int month,
int date,
int hours,
int minutes)
DateTime with zero in the time fields (HMS).month - it must be between 0 and 11 (same as Date)date - it must be between 1 and 31 (same as Date)hours - it must be between 0 and 23 (Hour in day)minutes - it must be between 0 and 59public DateTime(int year,
int month,
int date,
int hours,
int minutes,
int seconds)
DateTime with zero in the time fields (HMS).month - it must be between 0 and 11 (same as Date)date - it must be between 1 and 31 (same as Date)hours - it must be between 0 and 23 (Hour in day)minutes - it must be between 0 and 59seconds - it must be between 0 and 59public DateTime(int year,
int month,
int date,
int hours,
int minutes,
int seconds,
int millis)
DateTime with all its fields initialized.month - it must be between 0 and 11 (same as Date)date - it must be between 1 and 31 (same as Date)hours - it must be between 0 and 23 (Hour in day)minutes - it must be between 0 and 59seconds - it must be between 0 and 59millis - it must be between 0 and 999public DateTime add(long elapsed) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException - if elapsed time is negative.public boolean after(DateTime dt)
public boolean afterOrEquals(DateTime dt)
public boolean before(DateTime dt)
public boolean beforeOrEquals(DateTime dt)
public int compareTo(DateTime dt)
compareTo in interface java.lang.Comparable<DateTime>public DateTime decDate()
public DateTime decMonth()
public DateTime decYear()
public DateTime duplicate()
public boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic int getDate()
public int getHours()
public int getMilliseconds()
public int getMinutes()
public int getMonth()
public int getSeconds()
public int getYear()
public int hashCode()
hashCode in class java.lang.Objectpublic DateTime incDate()
public DateTime incMonth()
public DateTime incYear()
public boolean isSameDay(DateTime dt)
public void setDate(int date)
date - it must be between 1 and 31 (must be a valid value according to the month)public void setHMSM(int hours,
int minutes,
int seconds,
int milliseconds)
hours - it must be between 0 and 23 (Hour in day)public void setHours(int hours)
hours - it must be between 0 and 23 (Hour in day)public void setMilliseconds(int milliseconds)
public void setMinutes(int minutes)
minutes - it must be between 0 and 59public void setMonth(int month)
month - it must be between 0 and 11 (same as Date)public void setSeconds(int seconds)
seconds - it must be between 0 and 59public void setYear(int year)
public void setYMD(int year,
int month,
int date)
month - it must be between 0 and 11 (same as Date)date - it must be between 1 and 31 (same as Date)public java.lang.String toString()
toString in class java.lang.Object