Package tech.tablesaw.columns.datetimes
Class PackedLocalDateTime
- java.lang.Object
-
- tech.tablesaw.columns.instant.PackedInstant
-
- tech.tablesaw.columns.datetimes.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 timeThe 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 Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleanAM(long packedDateTime)Returns true if the time is in the AM or "before noon".static LocalDateTimeasLocalDateTime(long dateTime)static intdate(long packedDateTIme)static bytegetDayOfMonth(long date)static DayOfWeekgetDayOfWeek(long packedDateTime)static intgetDayOfYear(long packedDateTime)static bytegetHour(long packedLocalDateTime)static longgetMillisecondOfDay(long packedLocalDateTime)static shortgetMillisecondOfMinute(long packedLocalDateTime)static bytegetMinute(long packedLocalDateTime)static intgetMinuteOfDay(long packedLocalDateTime)static MonthgetMonth(long packedDateTime)static bytegetMonthValue(long dateTime)static intgetQuarter(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 DateTimeColumnstatic bytegetSecond(int packedLocalDateTime)static bytegetSecond(long packedLocalDateTime)static intgetSecondOfDay(long packedLocalDateTime)static intgetWeekOfYear(long packedDateTime)static shortgetYear(long dateTime)static booleanisAfter(long packedDateTime, long value)static booleanisBefore(long packedDateTime, long value)static booleanisFirstDayOfMonth(long packedDateTime)static booleanisFriday(long packedDateTime)static booleanisInApril(long packedDateTime)static booleanisInAugust(long packedDateTime)static booleanisInDecember(long packedDateTime)static booleanisInFebruary(long packedDateTime)static booleanisInJanuary(long packedDateTime)static booleanisInJuly(long packedDateTime)static booleanisInJune(long packedDateTime)static booleanisInMarch(long packedDateTime)static booleanisInMay(long packedDateTime)static booleanisInNovember(long packedDateTime)static booleanisInOctober(long packedDateTime)static booleanisInQ1(long packedDateTime)static booleanisInQ2(long packedDateTime)static booleanisInQ3(long packedDateTime)static booleanisInQ4(long packedDateTime)static booleanisInSeptember(long packedDateTime)static booleanisInYear(long packedDateTime, int year)static booleanisLastDayOfMonth(long packedDateTime)static booleanisLeapYear(long packedDateTime)static booleanisMidnight(long packedDateTime)static booleanisMonday(long packedDateTime)static booleanisNoon(long packedDateTime)static booleanisSaturday(long packedDateTime)static booleanisSunday(long packedDateTime)static booleanisThursday(long packedDateTime)static booleanisTuesday(long packedDateTime)static booleanisWednesday(long packedDateTime)static intlengthOfMonth(long packedDateTime)static intlengthOfYear(long packedDateTime)static intmonthsUntil(long packedDateTimeEnd, long packedDateStart)static longpack(short yr, byte m, byte d, byte hr, byte min, byte s, byte n)static longpack(LocalDate date, LocalTime time)static longpack(LocalDateTime dateTime)static booleanPM(long packedDateTime)Returns true if the time is in the PM or "after noon".static inttime(long packedDateTIme)static StringtoString(long dateTime)static intyearsUntil(long packedDateEnd, long packedDateStart)-
Methods inherited from class tech.tablesaw.columns.instant.PackedInstant
asInstant, create, daysUntil, hoursUntil, isEqualTo, isOnOrAfter, isOnOrBefore, minutesUntil, pack, plus, weeksUntil
-
-
-
-
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(LocalDateTime 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)
-
-