Class PackedLocalDateTime


  • public class PackedLocalDateTime
    extends PackedInstant
    A short localdatetime packed into a single long value. The long is comprised of an int for the date and an int for the time

    The bytes are packed into the date int as: First two bytes: short (year) next byte (month of year) last byte (day of month)

    The bytes are packed into the time int as First byte: hourOfDay next byte: minuteOfHour last two bytes (short): millisecond of minute

    Storing the millisecond of minute in an short requires that we treat the short as if it were unsigned. Unfortunately, Neither Java nor Guava provide unsigned short support so we use char, which is a 16-bit unsigned int to store values of up to 60,000 milliseconds (60 secs * 1000)

    • Method Detail

      • getDayOfMonth

        public static byte getDayOfMonth​(long date)
      • getYear

        public static short getYear​(long dateTime)
      • asLocalDateTime

        public static LocalDateTime asLocalDateTime​(long dateTime)
      • getMonthValue

        public static byte getMonthValue​(long dateTime)
      • pack

        public static long pack​(short yr,
                                byte m,
                                byte d,
                                byte hr,
                                byte min,
                                byte s,
                                byte n)
      • date

        public static int date​(long packedDateTIme)
      • time

        public static int time​(long packedDateTIme)
      • toString

        public static String toString​(long dateTime)
      • getDayOfYear

        public static int getDayOfYear​(long packedDateTime)
      • getWeekOfYear

        public static int getWeekOfYear​(long packedDateTime)
      • isLeapYear

        public static boolean isLeapYear​(long packedDateTime)
      • getMonth

        public static Month getMonth​(long packedDateTime)
      • lengthOfMonth

        public static int lengthOfMonth​(long packedDateTime)
      • getDayOfWeek

        public static DayOfWeek getDayOfWeek​(long packedDateTime)
      • getQuarter

        public static int getQuarter​(long packedDate)
        Returns the quarter of the year of the given date as an int from 1 to 4, or -1, if the argument is the missingValueIndicator() for DateTimeColumn
      • isInQ1

        public static boolean isInQ1​(long packedDateTime)
      • isInQ2

        public static boolean isInQ2​(long packedDateTime)
      • isInQ3

        public static boolean isInQ3​(long packedDateTime)
      • isInQ4

        public static boolean isInQ4​(long packedDateTime)
      • isAfter

        public static boolean isAfter​(long packedDateTime,
                                      long value)
      • isBefore

        public static boolean isBefore​(long packedDateTime,
                                       long value)
      • isSunday

        public static boolean isSunday​(long packedDateTime)
      • isMonday

        public static boolean isMonday​(long packedDateTime)
      • isTuesday

        public static boolean isTuesday​(long packedDateTime)
      • isWednesday

        public static boolean isWednesday​(long packedDateTime)
      • isThursday

        public static boolean isThursday​(long packedDateTime)
      • isFriday

        public static boolean isFriday​(long packedDateTime)
      • isSaturday

        public static boolean isSaturday​(long packedDateTime)
      • isFirstDayOfMonth

        public static boolean isFirstDayOfMonth​(long packedDateTime)
      • isInJanuary

        public static boolean isInJanuary​(long packedDateTime)
      • isInFebruary

        public static boolean isInFebruary​(long packedDateTime)
      • isInMarch

        public static boolean isInMarch​(long packedDateTime)
      • isInApril

        public static boolean isInApril​(long packedDateTime)
      • isInMay

        public static boolean isInMay​(long packedDateTime)
      • isInJune

        public static boolean isInJune​(long packedDateTime)
      • isInJuly

        public static boolean isInJuly​(long packedDateTime)
      • isInAugust

        public static boolean isInAugust​(long packedDateTime)
      • isInSeptember

        public static boolean isInSeptember​(long packedDateTime)
      • isInOctober

        public static boolean isInOctober​(long packedDateTime)
      • isInNovember

        public static boolean isInNovember​(long packedDateTime)
      • isInDecember

        public static boolean isInDecember​(long packedDateTime)
      • isLastDayOfMonth

        public static boolean isLastDayOfMonth​(long packedDateTime)
      • isInYear

        public static boolean isInYear​(long packedDateTime,
                                       int year)
      • isMidnight

        public static boolean isMidnight​(long packedDateTime)
      • isNoon

        public static boolean isNoon​(long packedDateTime)
      • AM

        public static boolean AM​(long packedDateTime)
        Returns true if the time is in the AM or "before noon". Note: we follow the convention that 12:00 NOON is PM and 12 MIDNIGHT is AM
      • PM

        public static boolean PM​(long packedDateTime)
        Returns true if the time is in the PM or "after noon". Note: we follow the convention that 12:00 NOON is PM and 12 MIDNIGHT is AM
      • getMinuteOfDay

        public static int getMinuteOfDay​(long packedLocalDateTime)
      • getSecond

        public static byte getSecond​(int packedLocalDateTime)
      • getHour

        public static byte getHour​(long packedLocalDateTime)
      • getMinute

        public static byte getMinute​(long packedLocalDateTime)
      • getSecond

        public static byte getSecond​(long packedLocalDateTime)
      • getSecondOfDay

        public static int getSecondOfDay​(long packedLocalDateTime)
      • getMillisecondOfMinute

        public static short getMillisecondOfMinute​(long packedLocalDateTime)
      • getMillisecondOfDay

        public static long getMillisecondOfDay​(long packedLocalDateTime)
      • lengthOfYear

        public static int lengthOfYear​(long packedDateTime)
      • monthsUntil

        public static int monthsUntil​(long packedDateTimeEnd,
                                      long packedDateStart)
      • yearsUntil

        public static int yearsUntil​(long packedDateEnd,
                                     long packedDateStart)