Package io.trino.type

Class DateTimes


  • public final class DateTimes
    extends Object
    • Method Detail

      • scaleEpochMicrosToMillis

        public static long scaleEpochMicrosToMillis​(long value)
      • epochMicrosToMillisWithRounding

        public static long epochMicrosToMillisWithRounding​(long epochMicros)
      • scaleEpochMillisToSeconds

        public static long scaleEpochMillisToSeconds​(long epochMillis)
      • scaleEpochMicrosToSeconds

        public static long scaleEpochMicrosToSeconds​(long epochMicros)
      • scaleEpochMillisToMicros

        public static long scaleEpochMillisToMicros​(long epochMillis)
      • epochSecondToMicrosWithRounding

        public static long epochSecondToMicrosWithRounding​(long epochSecond,
                                                           long picoOfSecond)
      • getMicrosOfSecond

        public static int getMicrosOfSecond​(long epochMicros)
      • getMillisOfSecond

        public static int getMillisOfSecond​(long epochMillis)
      • getMicrosOfMilli

        public static int getMicrosOfMilli​(long epochMicros)
      • toEpochMicros

        public static long toEpochMicros​(long epochMillis,
                                         int picosOfMilli)
      • round

        public static long round​(long value,
                                 int magnitude)
      • roundToNearest

        public static long roundToNearest​(long value,
                                          long bound)
      • scaleFactor

        public static long scaleFactor​(int fromPrecision,
                                       int toPrecision)
      • rescale

        public static long rescale​(long value,
                                   int fromPrecision,
                                   int toPrecision)
        Rescales a value of the given precision to another precision by adding 0s or truncating.
      • rescaleWithRounding

        public static long rescaleWithRounding​(long value,
                                               int fromPrecision,
                                               int toPrecision)
      • timestampHasTimeZone

        public static boolean timestampHasTimeZone​(String value)
      • extractTimestampPrecision

        public static int extractTimestampPrecision​(String value)
      • formatTimestamp

        public static String formatTimestamp​(int precision,
                                             long epochMicros,
                                             int picosOfMicro,
                                             ZoneId zoneId)
        Formats a timestamp of the given precision. This method doesn't do any rounding, so it's expected that the combination of [epochMicros, picosSecond] is already rounded to the provided precision if necessary
      • formatTimestamp

        public static String formatTimestamp​(int precision,
                                             long epochMicros,
                                             int picosOfMicro,
                                             ZoneId zoneId,
                                             DateTimeFormatter yearToSecondFormatter)
        Formats a timestamp of the given precision. This method doesn't do any rounding, so it's expected that the combination of [epochMicros, picosSecond] is already rounded to the provided precision if necessary
      • formatTimestampWithTimeZone

        public static String formatTimestampWithTimeZone​(int precision,
                                                         long epochMillis,
                                                         int picosOfMilli,
                                                         ZoneId zoneId)
      • parseTimestamp

        public static Object parseTimestamp​(int precision,
                                            String value)
      • parseTimestampWithTimeZone

        public static Object parseTimestampWithTimeZone​(int precision,
                                                        String value)
      • timeHasTimeZone

        public static boolean timeHasTimeZone​(String value)
      • extractTimePrecision

        public static int extractTimePrecision​(String value)
      • parseTime

        public static long parseTime​(String value)
      • parseTimeWithTimeZone

        public static Object parseTimeWithTimeZone​(int precision,
                                                   String value)
      • parseShortTimeWithTimeZone

        public static long parseShortTimeWithTimeZone​(String value)
      • longTimestamp

        public static LongTimestamp longTimestamp​(long epochSecond,
                                                  long fractionInPicos)
      • longTimestampWithTimeZone

        public static LongTimestampWithTimeZone longTimestampWithTimeZone​(long epochSecond,
                                                                          long fractionInPicos,
                                                                          ZoneId zoneId)
      • calculateOffsetMinutes

        public static int calculateOffsetMinutes​(int sign,
                                                 int offsetHour,
                                                 int offsetMinute)
      • getOffsetMinutes

        public static int getOffsetMinutes​(Instant instant,
                                           TimeZoneKey zoneKey)
      • isValidOffset

        public static boolean isValidOffset​(int hour,
                                            int minute)