Package org.hibernate.type.descriptor
Class DateTimeUtils
java.lang.Object
org.hibernate.type.descriptor.DateTimeUtils
Utilities for dealing with date/times
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final DateTimeFormatter
Pattern used for parsing literal datetimes in HQL.static final DateTimeFormatter
static final DateTimeFormatter
static final DateTimeFormatter
static final DateTimeFormatter
static final DateTimeFormatter
static final DateTimeFormatter
static final DateTimeFormatter
static final DateTimeFormatter
static final DateTimeFormatter
static final DateTimeFormatter
static final DateTimeFormatter
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final DateTimeFormatter
Pattern used for parsing literal offset datetimes in HQL. -
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends Temporal>
TadjustToDefaultPrecision
(T temporal, Dialect d) Do the same conversion that databases do when they encounter a timestamp with a higher precision than what is supported by a column, which is to round the excess fractions.static <T extends Temporal>
TadjustToPrecision
(T temporal, int precision, Dialect d) static void
appendAsDate
(SqlAppender appender, TemporalAccessor temporalAccessor) static void
appendAsDate
(SqlAppender appender, Calendar calendar) static void
appendAsDate
(SqlAppender appender, Date date) static void
appendAsLocalTime
(SqlAppender appender, TemporalAccessor temporalAccessor) static void
appendAsLocalTime
(SqlAppender appender, Calendar calendar) static void
appendAsLocalTime
(SqlAppender appender, Date date) static void
appendAsTime
(SqlAppender appender, TemporalAccessor temporalAccessor, boolean supportsOffset, TimeZone jdbcTimeZone) static void
appendAsTime
(SqlAppender appender, Calendar calendar) Deprecated.static void
appendAsTime
(SqlAppender appender, Calendar calendar, TimeZone jdbcTimeZone) static void
appendAsTime
(SqlAppender appender, Date date) Deprecated.UseappendAsLocalTime(SqlAppender, Date)
insteadstatic void
appendAsTime
(SqlAppender appender, Date date, TimeZone jdbcTimeZone) static void
appendAsTimestampWithMicros
(SqlAppender appender, TemporalAccessor temporalAccessor, boolean supportsOffset, TimeZone jdbcTimeZone) static void
appendAsTimestampWithMicros
(SqlAppender appender, TemporalAccessor temporalAccessor, boolean supportsOffset, TimeZone jdbcTimeZone, boolean allowZforZeroOffset) static void
appendAsTimestampWithMicros
(SqlAppender appender, Date date, TimeZone jdbcTimeZone) static void
appendAsTimestampWithMillis
(SqlAppender appender, TemporalAccessor temporalAccessor, boolean supportsOffset, TimeZone jdbcTimeZone) static void
appendAsTimestampWithMillis
(SqlAppender appender, Calendar calendar, TimeZone jdbcTimeZone) static void
appendAsTimestampWithMillis
(SqlAppender appender, Date date, TimeZone jdbcTimeZone) static void
appendAsTimestampWithNanos
(SqlAppender appender, TemporalAccessor temporalAccessor, boolean supportsOffset, TimeZone jdbcTimeZone) static void
appendAsTimestampWithNanos
(SqlAppender appender, TemporalAccessor temporalAccessor, boolean supportsOffset, TimeZone jdbcTimeZone, boolean allowZforZeroOffset) static void
appendAsTimestampWithNanos
(SqlAppender appender, Date date, TimeZone jdbcTimeZone) static <T extends Temporal>
TroundToDefaultPrecision
(T temporal, Dialect d) Deprecated, for removal: This API element is subject to removal in a future version.UseadjustToDefaultPrecision(Temporal, Dialect)
insteadstatic long
roundToPrecision
(int nano, int precision) static <T extends Temporal>
TroundToSecondPrecision
(T temporal, int precision) static <T extends Temporal>
TtruncateToPrecision
(T temporal, int precision)
-
Field Details
-
FORMAT_STRING_DATE
- See Also:
-
FORMAT_STRING_TIME_WITH_OFFSET
- See Also:
-
FORMAT_STRING_TIME
- See Also:
-
FORMAT_STRING_TIMESTAMP
- See Also:
-
FORMAT_STRING_TIMESTAMP_WITH_MILLIS
- See Also:
-
FORMAT_STRING_TIMESTAMP_WITH_MICROS
- See Also:
-
FORMAT_STRING_TIMESTAMP_WITH_NANOS
- See Also:
-
FORMAT_STRING_TIMESTAMP_WITH_MILLIS_AND_OFFSET
- See Also:
-
FORMAT_STRING_TIMESTAMP_WITH_MICROS_AND_OFFSET
- See Also:
-
FORMAT_STRING_TIMESTAMP_WITH_NANOS_AND_OFFSET
- See Also:
-
FORMAT_STRING_TIMESTAMP_WITH_MICROS_AND_OFFSET_NOZ
- See Also:
-
FORMAT_STRING_TIMESTAMP_WITH_NANOS_AND_OFFSET_NOZ
- See Also:
-
DATE_TIME_FORMATTER_DATE
-
DATE_TIME_FORMATTER_TIME_WITH_OFFSET
-
DATE_TIME_FORMATTER_TIME
-
DATE_TIME_FORMATTER_TIMESTAMP_WITH_MILLIS
-
DATE_TIME_FORMATTER_TIMESTAMP_WITH_MICROS
-
DATE_TIME_FORMATTER_TIMESTAMP_WITH_NANOS
-
DATE_TIME_FORMATTER_TIMESTAMP_WITH_MILLIS_AND_OFFSET
-
DATE_TIME_FORMATTER_TIMESTAMP_WITH_MICROS_AND_OFFSET
-
DATE_TIME_FORMATTER_TIMESTAMP_WITH_MICROS_AND_OFFSET_NOZ
-
DATE_TIME_FORMATTER_TIMESTAMP_WITH_NANOS_AND_OFFSET
-
DATE_TIME_FORMATTER_TIMESTAMP_WITH_NANOS_AND_OFFSET_NOZ
-
JDBC_ESCAPE_START_DATE
- See Also:
-
JDBC_ESCAPE_START_TIME
- See Also:
-
JDBC_ESCAPE_START_TIMESTAMP
- See Also:
-
JDBC_ESCAPE_END
- See Also:
-
DATE_TIME
Pattern used for parsing literal datetimes in HQL. Recognizes timestamps consisting of a date and time separated by either T or a space, and with an optional offset or time zone ID. Ideally we should accept both ISO and SQL standard zoned timestamp formats here. -
OFFSET_DATE_TIME
Pattern used for parsing literal offset datetimes in HQL. Recognizes timestamps consisting of a date and time separated by either T or a space, and with a required offset. Ideally we should accept both ISO and SQL standard timestamp formats here.
-
-
Method Details
-
appendAsTimestampWithNanos
public static void appendAsTimestampWithNanos(SqlAppender appender, TemporalAccessor temporalAccessor, boolean supportsOffset, TimeZone jdbcTimeZone) -
appendAsTimestampWithNanos
public static void appendAsTimestampWithNanos(SqlAppender appender, TemporalAccessor temporalAccessor, boolean supportsOffset, TimeZone jdbcTimeZone, boolean allowZforZeroOffset) -
appendAsTimestampWithMicros
public static void appendAsTimestampWithMicros(SqlAppender appender, TemporalAccessor temporalAccessor, boolean supportsOffset, TimeZone jdbcTimeZone) -
appendAsTimestampWithMicros
public static void appendAsTimestampWithMicros(SqlAppender appender, TemporalAccessor temporalAccessor, boolean supportsOffset, TimeZone jdbcTimeZone, boolean allowZforZeroOffset) -
appendAsTimestampWithMillis
public static void appendAsTimestampWithMillis(SqlAppender appender, TemporalAccessor temporalAccessor, boolean supportsOffset, TimeZone jdbcTimeZone) -
appendAsDate
-
appendAsTime
public static void appendAsTime(SqlAppender appender, TemporalAccessor temporalAccessor, boolean supportsOffset, TimeZone jdbcTimeZone) -
appendAsLocalTime
-
appendAsTimestampWithMillis
public static void appendAsTimestampWithMillis(SqlAppender appender, Date date, TimeZone jdbcTimeZone) -
appendAsTimestampWithMicros
public static void appendAsTimestampWithMicros(SqlAppender appender, Date date, TimeZone jdbcTimeZone) -
appendAsTimestampWithNanos
public static void appendAsTimestampWithNanos(SqlAppender appender, Date date, TimeZone jdbcTimeZone) -
appendAsDate
-
appendAsTime
Deprecated.UseappendAsLocalTime(SqlAppender, Date)
instead -
appendAsTime
-
appendAsLocalTime
-
appendAsTimestampWithMillis
public static void appendAsTimestampWithMillis(SqlAppender appender, Calendar calendar, TimeZone jdbcTimeZone) -
appendAsDate
-
appendAsTime
Deprecated.UseappendAsLocalTime(SqlAppender, Calendar)
instead -
appendAsTime
-
appendAsLocalTime
-
adjustToDefaultPrecision
Do the same conversion that databases do when they encounter a timestamp with a higher precision than what is supported by a column, which is to round the excess fractions. -
adjustToPrecision
-
truncateToPrecision
-
roundToDefaultPrecision
@Deprecated(forRemoval=true, since="6.6.1") public static <T extends Temporal> T roundToDefaultPrecision(T temporal, Dialect d) Deprecated, for removal: This API element is subject to removal in a future version.UseadjustToDefaultPrecision(Temporal, Dialect)
insteadDo the same conversion that databases do when they encounter a timestamp with a higher precision than what is supported by a column, which is to round the excess fractions. -
roundToSecondPrecision
-
roundToPrecision
public static long roundToPrecision(int nano, int precision)
-
appendAsLocalTime(SqlAppender, Calendar)
instead