|
|||||||||
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 java.lang.String |
formatDateTime(java.util.Date date,
java.lang.String format,
java.lang.String locale,
java.lang.String timeZone)
Formats a date using a format string. |
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 int |
getIsoDayOfWeek(java.util.Date date)
Return the day of week according to the ISO 8601 specification. |
static int |
getIsoWeek(java.util.Date date)
Returns the week of the year according to the ISO 8601 specification. |
static int |
getIsoYear(java.util.Date date)
Returns the year according to the ISO week definition. |
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 java.util.Date |
parseDateTime(java.lang.String date,
java.lang.String format,
java.lang.String locale,
java.lang.String timeZone)
Parses a date using a format string. |
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)
x
- the timestampcalendar
- the calendar
public 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)
x
- the datesource
- the calendar
public static Value convertTimeToUniversal(java.sql.Time x, java.util.Calendar source)
x
- the timesource
- the calendar
public static Value convertTimestampToUniversal(java.sql.Timestamp x, java.util.Calendar source)
x
- the timesource
- the calendar
public static java.sql.Date convertDateToCalendar(java.sql.Date x, java.util.Calendar calendar)
x
- the datecalendar
- the calendar
public static java.sql.Time convertTimeToCalendar(java.sql.Time x, java.util.Calendar calendar)
x
- the timecalendar
- the calendar
public static java.util.Date parseDateTime(java.lang.String original, int type, int errorCode)
original
- the original stringtype
- the value type (Value.TIME, TIMESTAMP, or DATE)errorCode
- the error code to use if an error occurs
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
public static int getIsoDayOfWeek(java.util.Date date)
date
- the date object which day of week should be calculated
public static int getIsoWeek(java.util.Date date)
date
- the date object which week of year should be calculated
public static int getIsoYear(java.util.Date date)
date
- the date object which year should be calculated
public static java.lang.String formatDateTime(java.util.Date date, java.lang.String format, java.lang.String locale, java.lang.String timeZone)
date
- the date to formatformat
- the format stringlocale
- the localetimeZone
- the timezone
public static java.util.Date parseDateTime(java.lang.String date, java.lang.String format, java.lang.String locale, java.lang.String timeZone)
date
- the date to parseformat
- the parsing formatlocale
- the localetimeZone
- the timeZone
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |