public class Time extends java.lang.Object implements java.lang.Comparable, Immutable
This class is designed as a simpler alternative to Date,
which has a number of problems, not the least of which is the fact that
Date is really a representation of a date and time.
Copyright 1997-2006 Partner Software, Inc.
DateAndTime,
Date| Modifier and Type | Field and Description |
|---|---|
static java.text.DateFormat |
format |
static java.lang.String |
formatPattern
SimpleDateFormat pattern used by format |
static java.lang.String |
twentyFourHourFormatPattern
SimpleDateFormat pattern using 1-24 as hours and including milliseconds |
| Constructor and Description |
|---|
Time()
Creates a Time object representing the current time.
|
Time(java.util.Date date)
Creates a time object from the given java.util.Date representation.
|
Time(long millis)
Creates a Time object from the given millisecond value.
|
Time(java.lang.String timeString)
Creates a time object from the given String representation.
|
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(java.lang.Object nother) |
boolean |
equals(java.lang.Object nother) |
long |
getMillis()
Returns milliseconds representing this time
|
java.sql.Date |
toJavaSqlDate() |
java.sql.Timestamp |
toJavaSqlTimestamp() |
java.util.Date |
toJavaUtilDate()
Returns this time represented as a
Date object. |
java.lang.String |
toString()
Returns a String in the standard
format representing the Date. |
java.lang.String |
toString(java.lang.String formatString)
Returns a String in the specific format representing the Date.
|
public static final java.lang.String twentyFourHourFormatPattern
SimpleDateFormat pattern using 1-24 as hours and including millisecondspublic static final java.lang.String formatPattern
SimpleDateFormat pattern used by formatpublic static final java.text.DateFormat format
public Time()
public Time(long millis)
public Time(java.lang.String timeString)
format to parse it.timeString - java.lang.IllegalArgumentException - if it's a bad String.public Time(java.util.Date date)
date - public java.util.Date toJavaUtilDate()
Date object.public boolean equals(java.lang.Object nother)
equals in class java.lang.Objectpublic int compareTo(java.lang.Object nother)
compareTo in interface java.lang.Comparablepublic long getMillis()
public java.lang.String toString()
format representing the Date.toString in class java.lang.Objectpublic java.lang.String toString(java.lang.String formatString)
public java.sql.Timestamp toJavaSqlTimestamp()
public java.sql.Date toJavaSqlDate()