|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.hsqldb.HsqlDateTime
collection of static methods to convert Date, Time and Timestamp strings into corresponding Java objects. Also accepts SQL literals such as NOW, TODAY as valid strings and returns the current date / time / datetime. Compatible with jdk 1.1.x.
Was reviewed for 1.7.2 resulting in centralising all DATETIME related operstions.
HSQLDB uses the client and server's default timezone for all DATETIME operations. It stores the DATETIME values in .log and .script files using the default local of the server. The same values are stored as binary UTC timestamps in .data files. If the database is trasported from one timezone to another, then the DATETIME values in cached tables will be handled as UTC but those in other tables will be treated as local. So a timestamp representing 12 noon stored in Tokyo timezone will be treated as 9 pm in London when stored in a cached table but the same value stored in a memory table will be treated as 12 noon.
Constructor Summary | |
HsqlDateTime()
|
Method Summary | |
static Date |
dateValue(String s)
Converts a string in JDBC date escape format to a Date
value. |
static Time |
getCurrentTime()
|
static String |
getDateString(Date x,
Calendar cal)
|
static Date |
getNormalisedDate(Date d)
|
static long |
getNormalisedDate(long d)
|
static Date |
getNormalisedDate(Timestamp ts)
|
static Time |
getNormalisedTime(long t)
|
static Time |
getNormalisedTime(Time t)
|
static Time |
getNormalisedTime(Timestamp ts)
|
static Timestamp |
getNormalisedTimestamp(Date d)
|
static Timestamp |
getNormalisedTimestamp(Time t)
|
static String |
getTimestampString(Timestamp x,
Calendar cal)
|
static String |
getTimeString(Time x,
Calendar cal)
|
static void |
resetToDate(Calendar cal)
|
static void |
resetToTime(Calendar cal)
|
static Timestamp |
timestampValue(long time,
int nano)
|
static Time |
timeValue(String s)
Converts a string in JDBC date escape format to a Time value. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public HsqlDateTime()
Method Detail |
public static Timestamp timestampValue(long time, int nano)
time
- millisecondsnano
- nanoseconds
public static Date dateValue(String s)
Date
value. Also accepts Timestamp values.
s
- date in format yyyy-mm-dd
,
'TODAY', 'NOW', 'CURRENT_DATE', 'SYSDATE' (case independent)
Date
value
IllegalArgumentException
- if the given argument
does not have the format yyyy-mm-dd
public static Time timeValue(String s)
Time
value.
s
- date in format hh:mm:ss
'CURRENT_TIME' (case independent)
Time
value
IllegalArgumentException
- if the given argument
does not have the format hh:mm:ss
public static Time getCurrentTime()
public static String getTimestampString(Timestamp x, Calendar cal) throws Exception
Exception
public static String getTimeString(Time x, Calendar cal) throws Exception
Exception
public static String getDateString(Date x, Calendar cal) throws Exception
Exception
public static void resetToDate(Calendar cal)
public static void resetToTime(Calendar cal)
public static Time getNormalisedTime(long t)
public static Time getNormalisedTime(Time t)
public static Time getNormalisedTime(Timestamp ts)
public static long getNormalisedDate(long d)
public static Date getNormalisedDate(Timestamp ts)
public static Date getNormalisedDate(Date d)
public static Timestamp getNormalisedTimestamp(Time t)
public static Timestamp getNormalisedTimestamp(Date d)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |