| java.lang.Object org.hsqldb.HsqlDateTime
HsqlDateTime | public class HsqlDateTime (Code) | | 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 locale 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.
author: fredt@users version: 1.7.2 since: 1.7.0 |
Inner Class :static class Tokenizer | |
Method Summary | |
static int | compare(Date a, Date b) | static int | compare(Time a, Time b) | static int | compare(Timestamp a, Timestamp b) | public static Date | dateValue(String s) Converts a string in JDBC date escape format to a Date
value. | public static synchronized Date | getCurrentDate(long millis) | public static String | getDateString(java.util.Date x, Calendar cal) | static int | getDateTimePart(java.util.Date d, int part) Returns the indicated part of the given java.util.Date object. | public static long | getNormalisedDate(long d) | public static Date | getNormalisedDate(Timestamp ts) | public static Date | getNormalisedDate(Date d) | public static long | getNormalisedTime(long t) | public static Time | getNormalisedTime(Time t) | public static Time | getNormalisedTime(Timestamp ts) | public static Timestamp | getNormalisedTimestamp(Time t) | public static Timestamp | getNormalisedTimestamp(Date d) | public static String | getSytemTimeString() | public static long | getTimeInMillis(java.util.Date dt, Calendar source, Calendar target) | public static long | getTimeInMillis(Calendar cal) Gets the time from the given Calendar as a milliseconds value; wrapper method to
allow use of more efficient JDK1.4 method on JDK1.4 (was protected in earlier versions). | public static String | getTimeString(java.util.Date x, Calendar cal) | public static Timestamp | getTimestamp(long millis) | public static String | getTimestampString(Timestamp x) | public static String | getTimestampString(Timestamp x, Calendar cal) | public static String | getTimestampString(long timestamp) | static synchronized Calendar | getToday(long millis) Returns the same Date Object. | public static void | resetToDate(Calendar cal) | public static void | resetToTime(Calendar cal) | public static Timestamp | simpleTimestampValue(String s) | public static Time | timeValue(String s) Converts a string in JDBC date escape format to a
Time value. | public static Timestamp | timestampValue(String s) Converts a string in JDBC timestamp escape format to a
Timestamp value. | public static Timestamp | timestampValue(long time, int nano) | public static String | toJavaDatePattern(String format) |
e | final public static char e(Code) | | Indicates end-of-input
|
dateValue | public static Date dateValue(String s) throws HsqlException(Code) | | Converts a string in JDBC date escape format to a Date
value. Also accepts Timestamp values.
Parameters: s - date in format yyyy-mm-dd , corresponding Date value exception: java.lang.IllegalArgumentException - if the given argumentdoes not have the format yyyy-mm-dd |
getCurrentDate | public static synchronized Date getCurrentDate(long millis)(Code) | | |
getDateTimePart | static int getDateTimePart(java.util.Date d, int part)(Code) | | Returns the indicated part of the given java.util.Date object.
Parameters: d - the Date object from which to extract the indicated part Parameters: part - an integer code corresponding to the desired date part the indicated part of the given java.util.Date object |
getNormalisedDate | public static long getNormalisedDate(long d)(Code) | | |
getNormalisedTime | public static long getNormalisedTime(long t)(Code) | | |
getSytemTimeString | public static String getSytemTimeString()(Code) | | |
getTimeInMillis | public static long getTimeInMillis(Calendar cal)(Code) | | Gets the time from the given Calendar as a milliseconds value; wrapper method to
allow use of more efficient JDK1.4 method on JDK1.4 (was protected in earlier versions).
Parameters: cal - the Calendar the time value in milliseconds |
getTimestampString | public static String getTimestampString(Timestamp x)(Code) | | Creates a valid timestamp string - jre 1.3 returns incorrect date part
for Timestamp.toString();
|
getTimestampString | public static String getTimestampString(Timestamp x, Calendar cal)(Code) | | Creates a full length timestamp string, with 9 digist for nanos
|
getTimestampString | public static String getTimestampString(long timestamp)(Code) | | |
getToday | static synchronized Calendar getToday(long millis)(Code) | | Returns the same Date Object. This object should be treated as
read-only.
|
simpleTimestampValue | public static Timestamp simpleTimestampValue(String s)(Code) | | For use with .script file, simpler than above
|
timeValue | public static Time timeValue(String s)(Code) | | Converts a string in JDBC date escape format to a
Time value.
Parameters: s - date in format hh:mm:ss corresponding Time value exception: java.lang.IllegalArgumentException - if the given argumentdoes not have the format hh:mm:ss |
timestampValue | public static Timestamp timestampValue(String s) throws HsqlException(Code) | | Converts a string in JDBC timestamp escape format to a
Timestamp value.
Parameters: s - timestamp in format yyyy-mm-dd hh:mm:ss.fffffffff where end part can be omitted, or "NOW" (case insensitive) corresponding Timestamp value exception: java.lang.IllegalArgumentException - if the given argumentdoes not have the format yyyy-mm-dd hh:mm:ss.fffffffff |
timestampValue | public static Timestamp timestampValue(long time, int nano)(Code) | | Parameters: time - milliseconds Parameters: nano - nanoseconds Timestamp object |
toJavaDatePattern | public static String toJavaDatePattern(String format)(Code) | | Converts the given format into a pattern accepted by java.text.SimpleDataFormat
Parameters: format - |
|
|