|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectorg.h2.util.DateTimeUtils
public class DateTimeUtils
This utility class contains time conversion functions.
| Method Summary | |
|---|---|
static java.sql.Date |
cloneAndNormalizeDate(java.sql.Date value)
Clone a date object and reset the hour, minutes, seconds, and milliseconds to zero. |
static java.sql.Time |
cloneAndNormalizeTime(java.sql.Time value)
Clone a time object and reset the day to 1970-01-01. |
static java.sql.Date |
convertDateToCalendar(java.sql.Date x,
java.util.Calendar calendar)
Convert the date to the specified time zone. |
static Value |
convertDateToUniversal(java.sql.Date x,
java.util.Calendar source)
Convert the date from the specified time zone to UTC. |
static java.sql.Timestamp |
convertTimestampToCalendar(java.sql.Timestamp x,
java.util.Calendar calendar)
Convert the timestamp to the specified time zone. |
static Value |
convertTimestampToUniversal(java.sql.Timestamp x,
java.util.Calendar source)
Convert the timestamp from the specified time zone to UTC. |
static java.sql.Time |
convertTimeToCalendar(java.sql.Time x,
java.util.Calendar calendar)
Convert the time to the specified time zone. |
static Value |
convertTimeToUniversal(java.sql.Time x,
java.util.Calendar source)
Convert the time from the specified time zone to UTC. |
static int |
getDatePart(java.util.Date d,
int field)
Get the specified field of a date, however with years normalized to positive or negative, and month starting with 1. |
static long |
getTimeGMT(long millis)
Convert the number of milliseconds since 1970-01-01 in the local timezone to GMT. |
static long |
getTimeLocal(java.util.Date d)
Get the number of milliseconds since 1970-01-01 in the local timezone. |
static java.util.Date |
parseDateTime(java.lang.String original,
int type,
int errorCode)
Parse a date, time or timestamp value. |
static void |
resetCalendar()
Reset the calendar, for example after changing the default timezone. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static void resetCalendar()
public static java.sql.Timestamp convertTimestampToCalendar(java.sql.Timestamp x,
java.util.Calendar calendar)
throws java.sql.SQLException
x - the timestampcalendar - the calendar
java.sql.SQLExceptionpublic static java.sql.Time cloneAndNormalizeTime(java.sql.Time value)
value - the time value
public static java.sql.Date cloneAndNormalizeDate(java.sql.Date value)
value - the date value
public static Value convertDateToUniversal(java.sql.Date x,
java.util.Calendar source)
throws java.sql.SQLException
x - the datesource - the calendar
java.sql.SQLException
public static Value convertTimeToUniversal(java.sql.Time x,
java.util.Calendar source)
throws java.sql.SQLException
x - the timesource - the calendar
java.sql.SQLException
public static Value convertTimestampToUniversal(java.sql.Timestamp x,
java.util.Calendar source)
throws java.sql.SQLException
x - the timesource - the calendar
java.sql.SQLException
public static java.sql.Date convertDateToCalendar(java.sql.Date x,
java.util.Calendar calendar)
throws java.sql.SQLException
x - the datecalendar - the calendar
java.sql.SQLException
public static java.sql.Time convertTimeToCalendar(java.sql.Time x,
java.util.Calendar calendar)
throws java.sql.SQLException
x - the timecalendar - the calendar
java.sql.SQLException
public static java.util.Date parseDateTime(java.lang.String original,
int type,
int errorCode)
throws java.sql.SQLException
original - the original stringtype - the value type (Value.TIME, TIMESTAMP, or DATE)errorCode - the error code to use if an error occurs
java.sql.SQLException
public static int getDatePart(java.util.Date d,
int field)
d - the datefield - the field type
public static long getTimeLocal(java.util.Date d)
d - the date
public static long getTimeGMT(long millis)
millis - the number of milliseconds in the local timezone
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||