Package org.hibernate.type.descriptor
Class DateTimeUtils
- java.lang.Object
-
- org.hibernate.type.descriptor.DateTimeUtils
-
public final class DateTimeUtils extends Object
Utilities for dealing with date/times
-
-
Field Summary
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static voidappendAsDate(SqlAppender appender, TemporalAccessor temporalAccessor)static voidappendAsDate(SqlAppender appender, Calendar calendar)static voidappendAsDate(SqlAppender appender, Date date)static voidappendAsLocalTime(SqlAppender appender, TemporalAccessor temporalAccessor)static voidappendAsLocalTime(SqlAppender appender, Calendar calendar)static voidappendAsLocalTime(SqlAppender appender, Date date)static voidappendAsTime(SqlAppender appender, TemporalAccessor temporalAccessor, boolean supportsOffset, TimeZone jdbcTimeZone)static voidappendAsTime(SqlAppender appender, Calendar calendar)Deprecated.UseappendAsLocalTime(SqlAppender, Calendar)insteadstatic voidappendAsTime(SqlAppender appender, Calendar calendar, TimeZone jdbcTimeZone)static voidappendAsTime(SqlAppender appender, Date date)Deprecated.UseappendAsLocalTime(SqlAppender, Date)insteadstatic voidappendAsTime(SqlAppender appender, Date date, TimeZone jdbcTimeZone)static voidappendAsTimestampWithMicros(SqlAppender appender, TemporalAccessor temporalAccessor, boolean supportsOffset, TimeZone jdbcTimeZone)static voidappendAsTimestampWithMicros(SqlAppender appender, TemporalAccessor temporalAccessor, boolean supportsOffset, TimeZone jdbcTimeZone, boolean allowZforZeroOffset)static voidappendAsTimestampWithMicros(SqlAppender appender, Calendar calendar, TimeZone jdbcTimeZone)Deprecated, for removal: This API element is subject to removal in a future version.static voidappendAsTimestampWithMicros(SqlAppender appender, Date date, TimeZone jdbcTimeZone)static voidappendAsTimestampWithMillis(SqlAppender appender, TemporalAccessor temporalAccessor, boolean supportsOffset, TimeZone jdbcTimeZone)static voidappendAsTimestampWithMillis(SqlAppender appender, Calendar calendar, TimeZone jdbcTimeZone)static voidappendAsTimestampWithMillis(SqlAppender appender, Date date, TimeZone jdbcTimeZone)static voidappendAsTimestampWithNanos(SqlAppender appender, TemporalAccessor temporalAccessor, boolean supportsOffset, TimeZone jdbcTimeZone)static voidappendAsTimestampWithNanos(SqlAppender appender, TemporalAccessor temporalAccessor, boolean supportsOffset, TimeZone jdbcTimeZone, boolean allowZforZeroOffset)static voidappendAsTimestampWithNanos(SqlAppender appender, Date date, TimeZone jdbcTimeZone)static <T extends Temporal>
TroundToDefaultPrecision(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 longroundToPrecision(int nano, int precision)
-
-
-
Field Detail
-
FORMAT_STRING_DATE
public static final String FORMAT_STRING_DATE
- See Also:
- Constant Field Values
-
FORMAT_STRING_TIME_WITH_OFFSET
public static final String FORMAT_STRING_TIME_WITH_OFFSET
- See Also:
- Constant Field Values
-
FORMAT_STRING_TIME
public static final String FORMAT_STRING_TIME
- See Also:
- Constant Field Values
-
FORMAT_STRING_TIMESTAMP
public static final String FORMAT_STRING_TIMESTAMP
- See Also:
- Constant Field Values
-
FORMAT_STRING_TIMESTAMP_WITH_MILLIS
public static final String FORMAT_STRING_TIMESTAMP_WITH_MILLIS
- See Also:
- Constant Field Values
-
FORMAT_STRING_TIMESTAMP_WITH_MICROS
public static final String FORMAT_STRING_TIMESTAMP_WITH_MICROS
- See Also:
- Constant Field Values
-
FORMAT_STRING_TIMESTAMP_WITH_NANOS
public static final String FORMAT_STRING_TIMESTAMP_WITH_NANOS
- See Also:
- Constant Field Values
-
FORMAT_STRING_TIMESTAMP_WITH_MILLIS_AND_OFFSET
public static final String FORMAT_STRING_TIMESTAMP_WITH_MILLIS_AND_OFFSET
- See Also:
- Constant Field Values
-
FORMAT_STRING_TIMESTAMP_WITH_MICROS_AND_OFFSET
public static final String FORMAT_STRING_TIMESTAMP_WITH_MICROS_AND_OFFSET
- See Also:
- Constant Field Values
-
FORMAT_STRING_TIMESTAMP_WITH_NANOS_AND_OFFSET
public static final String FORMAT_STRING_TIMESTAMP_WITH_NANOS_AND_OFFSET
- See Also:
- Constant Field Values
-
FORMAT_STRING_TIMESTAMP_WITH_MICROS_AND_OFFSET_NOZ
public static final String FORMAT_STRING_TIMESTAMP_WITH_MICROS_AND_OFFSET_NOZ
- See Also:
- Constant Field Values
-
FORMAT_STRING_TIMESTAMP_WITH_NANOS_AND_OFFSET_NOZ
public static final String FORMAT_STRING_TIMESTAMP_WITH_NANOS_AND_OFFSET_NOZ
- See Also:
- Constant Field Values
-
DATE_TIME_FORMATTER_DATE
public static final DateTimeFormatter DATE_TIME_FORMATTER_DATE
-
DATE_TIME_FORMATTER_TIME_WITH_OFFSET
public static final DateTimeFormatter DATE_TIME_FORMATTER_TIME_WITH_OFFSET
-
DATE_TIME_FORMATTER_TIME
public static final DateTimeFormatter DATE_TIME_FORMATTER_TIME
-
DATE_TIME_FORMATTER_TIMESTAMP_WITH_MILLIS
public static final DateTimeFormatter DATE_TIME_FORMATTER_TIMESTAMP_WITH_MILLIS
-
DATE_TIME_FORMATTER_TIMESTAMP_WITH_MICROS
public static final DateTimeFormatter DATE_TIME_FORMATTER_TIMESTAMP_WITH_MICROS
-
DATE_TIME_FORMATTER_TIMESTAMP_WITH_NANOS
public static final DateTimeFormatter DATE_TIME_FORMATTER_TIMESTAMP_WITH_NANOS
-
DATE_TIME_FORMATTER_TIMESTAMP_WITH_MILLIS_AND_OFFSET
public static final DateTimeFormatter DATE_TIME_FORMATTER_TIMESTAMP_WITH_MILLIS_AND_OFFSET
-
DATE_TIME_FORMATTER_TIMESTAMP_WITH_MICROS_AND_OFFSET
public static final DateTimeFormatter DATE_TIME_FORMATTER_TIMESTAMP_WITH_MICROS_AND_OFFSET
-
DATE_TIME_FORMATTER_TIMESTAMP_WITH_MICROS_AND_OFFSET_NOZ
public static final DateTimeFormatter DATE_TIME_FORMATTER_TIMESTAMP_WITH_MICROS_AND_OFFSET_NOZ
-
DATE_TIME_FORMATTER_TIMESTAMP_WITH_NANOS_AND_OFFSET
public static final DateTimeFormatter DATE_TIME_FORMATTER_TIMESTAMP_WITH_NANOS_AND_OFFSET
-
DATE_TIME_FORMATTER_TIMESTAMP_WITH_NANOS_AND_OFFSET_NOZ
public static final DateTimeFormatter DATE_TIME_FORMATTER_TIMESTAMP_WITH_NANOS_AND_OFFSET_NOZ
-
JDBC_ESCAPE_START_DATE
public static final String JDBC_ESCAPE_START_DATE
- See Also:
- Constant Field Values
-
JDBC_ESCAPE_START_TIME
public static final String JDBC_ESCAPE_START_TIME
- See Also:
- Constant Field Values
-
JDBC_ESCAPE_START_TIMESTAMP
public static final String JDBC_ESCAPE_START_TIMESTAMP
- See Also:
- Constant Field Values
-
JDBC_ESCAPE_END
public static final String JDBC_ESCAPE_END
- See Also:
- Constant Field Values
-
DATE_TIME
public static final DateTimeFormatter 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
public static final DateTimeFormatter 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 Detail
-
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
public static void appendAsDate(SqlAppender appender, TemporalAccessor temporalAccessor)
-
appendAsTime
public static void appendAsTime(SqlAppender appender, TemporalAccessor temporalAccessor, boolean supportsOffset, TimeZone jdbcTimeZone)
-
appendAsLocalTime
public static void appendAsLocalTime(SqlAppender appender, TemporalAccessor temporalAccessor)
-
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
public static void appendAsDate(SqlAppender appender, Date date)
-
appendAsTime
@Deprecated public static void appendAsTime(SqlAppender appender, Date date)
Deprecated.UseappendAsLocalTime(SqlAppender, Date)instead
-
appendAsTime
public static void appendAsTime(SqlAppender appender, Date date, TimeZone jdbcTimeZone)
-
appendAsLocalTime
public static void appendAsLocalTime(SqlAppender appender, Date date)
-
appendAsTimestampWithMillis
public static void appendAsTimestampWithMillis(SqlAppender appender, Calendar calendar, TimeZone jdbcTimeZone)
-
appendAsTimestampWithMicros
@Deprecated(forRemoval=true) public static void appendAsTimestampWithMicros(SqlAppender appender, Calendar calendar, TimeZone jdbcTimeZone)
Deprecated, for removal: This API element is subject to removal in a future version.Calendar has no microseconds.
-
appendAsDate
public static void appendAsDate(SqlAppender appender, Calendar calendar)
-
appendAsTime
@Deprecated public static void appendAsTime(SqlAppender appender, Calendar calendar)
Deprecated.UseappendAsLocalTime(SqlAppender, Calendar)instead
-
appendAsTime
public static void appendAsTime(SqlAppender appender, Calendar calendar, TimeZone jdbcTimeZone)
-
appendAsLocalTime
public static void appendAsLocalTime(SqlAppender appender, Calendar calendar)
-
roundToDefaultPrecision
public static <T extends Temporal> T roundToDefaultPrecision(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.
-
roundToPrecision
public static long roundToPrecision(int nano, int precision)
-
-