|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectewe.data.DataObject
ewe.sys.Time
Time identifies a date and time, storing information to millisecond precision only. A Time object is displayed as a string in a manner specified by the "format" string. If this value is null it will be formatted as by the "defaultFormat" string.
The format string uses the convention as the java.util.SimpleDateFormat with some specifiers left out. What is included are:
Symbol Meaning Presentation Example ------ ------- ------------ ------- y year (Number) 1996 M month in year (Text & Number) July & 07 d day in month (Number) 10 h hour in am/pm (1~12) (Number) 12 H hour in day (0~23) (Number) 0 m minute in hour (Number) 30 s second in minute (Number) 55 S millisecond (Number) 978 E day in week (Text) Tuesday a am/pm marker (Text) PM ' escape for text
Time also implements Textable and getText()/setText() encodes the object in a numeric form that is independant of the format used for toString()/fromString().
| Field Summary | |
String |
_fields
|
int |
day
The day in the range of 1 to the last day in the month. |
static int |
DAY
|
int |
dayOfWeek
The day of the week in the range 1 to 7, with 1 being Monday and 7 being Sunday |
static String |
defaultFormat
The default format to use if one is not specified. |
protected static long |
epoch
|
String |
format
The date format to use for I/O with this Time object. |
int |
hour
The hour in the range of 0 to 23. |
static int |
HOUR
|
int |
millis
Milliseconds in the range of 0 to 999. |
int |
minute
The minute in the range of 0 to 59. |
static int |
MINUTE
|
int |
month
The month in the range of 1 to 12. |
static int |
MONTH
|
int |
second
The second in the range of 0 to 59. |
static int |
SECOND
|
int |
year
The year as its full set of digits (year 2010 is 2010). |
static int |
YEAR
|
| Constructor Summary | |
Time()
Constructs a time object set to the current date and time. |
|
Time(int day,
int month,
int year)
|
|
| Method Summary | |
boolean |
after(Time other)
|
boolean |
before(Time other)
|
static int |
compareEncodedTimes(long one,
long two,
boolean ignoreDate,
boolean ignoreTime)
Compare two encoded times. |
int |
compareTo(Object other)
Compare this object with another. |
static long |
convertSystemTime(long time,
boolean toSystem)
|
static DateChange |
dateDifference(Time later,
Time earlier,
DateChange destination)
|
DateChange |
difference(Time earlier,
DateChange destination)
|
boolean |
equals(Object other)
Returns if this object is considered equal to the other object. |
String |
format(String dateFormat)
|
void |
fromString(String source)
|
void |
fromString(String source,
Locale locale)
|
static boolean |
fromString(String source,
Time t,
String format,
Locale locale)
|
String |
getDefaultFormat()
|
long |
getEncodedTime()
This converts to a 64-bit encoded values saving the year, month, day, hours, min, sec, millisec in a platform independent manner. |
String |
getFormat()
|
String |
getText()
|
long |
getTime()
This converts the time into a 64-bit time value and represents the number of milliseconds since Jan 1, 1970. |
int |
hashCode()
Returns a hashCode for the object. |
static int |
indexOfDayInWeek(int dayOfWeek,
Locale locale)
This returns the index of the day in the week. |
static boolean |
isLeapYear(int year)
|
boolean |
isValid()
|
static int |
numberOfDays(int month,
int year)
Find the number of days in a month. |
void |
parse(String dateValue)
|
void |
parse(String dateValue,
String dateFormat)
|
Time |
roundTo(int roundTo)
Rounds this time down. |
Time |
setEncodedTime(long from)
This converts from a 64-bit encoded values saving the year, month, day, hours, min, sec, millisec in a platform independent manner. |
Time |
setFormat(String format)
|
void |
setText(String text)
|
Time |
setTime(long source)
This converts a 64-bit absolute time value as provided by getTime() (which represents the number of milliseconds since Jan 1, 1970). |
Time |
setToCurrentTime()
Set the time to be the current time. |
String |
toString()
Return a String representation of this object. |
String |
toString(Locale locale)
|
static String |
toString(Time t,
String format,
Locale locale)
|
Time |
update()
Update values like dayOfWeek from the year, month, day and time values. |
| Methods inherited from class ewe.data.DataObject |
_getSetField, appendAllFields, copied, copyFrom, getCopy, getDeclaredField, getDeclaredFieldValue, getDeclaredFieldValue, getFieldList, getFieldList, getMyFieldList, getNew |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass |
| Field Detail |
public int year
public int month
public int day
public int hour
public int minute
public int second
public int millis
public int dayOfWeek
public String format
public static String defaultFormat
public String _fields
protected static long epoch
public static final int SECOND
public static final int MINUTE
public static final int HOUR
public static final int DAY
public static final int MONTH
public static final int YEAR
| Constructor Detail |
public Time()
public Time(int day,
int month,
int year)
| Method Detail |
public static long convertSystemTime(long time,
boolean toSystem)
public boolean isValid()
public static boolean isLeapYear(int year)
public static DateChange dateDifference(Time later,
Time earlier,
DateChange destination)
throws IllegalArgumentException
IllegalArgumentException
public DateChange difference(Time earlier,
DateChange destination)
throws IllegalArgumentException
IllegalArgumentExceptionpublic long getTime()
public Time setTime(long source)
This returns this Time value if the time is valid and null if it is not.
public Time update()
public Time setFormat(String format)
public String getFormat()
public String getDefaultFormat()
public void parse(String dateValue,
String dateFormat)
throws IllegalArgumentException
IllegalArgumentException
public void parse(String dateValue)
throws IllegalArgumentException
IllegalArgumentExceptionpublic String format(String dateFormat)
public void fromString(String source)
fromString in interface Stringable
public void fromString(String source,
Locale locale)
public Time roundTo(int roundTo)
roundTo - should be SECOND, MINUTE, HOUR, ...public int compareTo(Object other)
Comparable
compareTo in interface ComparablecompareTo in class DataObjectpublic boolean before(Time other)
public boolean after(Time other)
public String toString()
Object
toString in interface StringabletoString in class Objectpublic String toString(Locale locale)
public static String toString(Time t,
String format,
Locale locale)
public static boolean fromString(String source,
Time t,
String format,
Locale locale)
public static int numberOfDays(int month,
int year)
public static int indexOfDayInWeek(int dayOfWeek,
Locale locale)
public long getEncodedTime()
public Time setEncodedTime(long from)
public static int compareEncodedTimes(long one,
long two,
boolean ignoreDate,
boolean ignoreTime)
one - An encoded time from getEncodedTime().two - An encoded time from getEncodedTime().ignoreDate - if this is true then the date portion will be ignored.ignoreTime - if this is true then the time portion will be ignored.
public String getText()
getText in interface Textablepublic void setText(String text)
setText in interface Textablepublic boolean equals(Object other)
Object
equals in class DataObjectpublic int hashCode()
Object
hashCode in class Objectpublic Time setToCurrentTime()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||