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 boolean
AM(long packedDateTime)
Returns true if the time is in the AM or "before noon".static LocalDateTime
asLocalDateTime(long dateTime)
static int
date(long packedDateTIme)
static byte
getDayOfMonth(long date)
static DayOfWeek
getDayOfWeek(long packedDateTime)
static int
getDayOfYear(long packedDateTime)
static byte
getHour(long packedLocalDateTime)
static long
getMillisecondOfDay(long packedLocalDateTime)
static short
getMillisecondOfMinute(long packedLocalDateTime)
static byte
getMinute(long packedLocalDateTime)
static int
getMinuteOfDay(long packedLocalDateTime)
static Month
getMonth(long packedDateTime)
static byte
getMonthValue(long dateTime)
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 DateTimeColumnstatic byte
getSecond(int packedLocalDateTime)
static byte
getSecond(long packedLocalDateTime)
static int
getSecondOfDay(long packedLocalDateTime)
static int
getWeekOfYear(long packedDateTime)
static short
getYear(long dateTime)
static boolean
isAfter(long packedDateTime, long value)
static boolean
isBefore(long packedDateTime, long value)
static boolean
isFirstDayOfMonth(long packedDateTime)
static boolean
isFriday(long packedDateTime)
static boolean
isInApril(long packedDateTime)
static boolean
isInAugust(long packedDateTime)
static boolean
isInDecember(long packedDateTime)
static boolean
isInFebruary(long packedDateTime)
static boolean
isInJanuary(long packedDateTime)
static boolean
isInJuly(long packedDateTime)
static boolean
isInJune(long packedDateTime)
static boolean
isInMarch(long packedDateTime)
static boolean
isInMay(long packedDateTime)
static boolean
isInNovember(long packedDateTime)
static boolean
isInOctober(long packedDateTime)
static boolean
isInQ1(long packedDateTime)
static boolean
isInQ2(long packedDateTime)
static boolean
isInQ3(long packedDateTime)
static boolean
isInQ4(long packedDateTime)
static boolean
isInSeptember(long packedDateTime)
static boolean
isInYear(long packedDateTime, int year)
static boolean
isLastDayOfMonth(long packedDateTime)
static boolean
isLeapYear(long packedDateTime)
static boolean
isMidnight(long packedDateTime)
static boolean
isMonday(long packedDateTime)
static boolean
isNoon(long packedDateTime)
static boolean
isSaturday(long packedDateTime)
static boolean
isSunday(long packedDateTime)
static boolean
isThursday(long packedDateTime)
static boolean
isTuesday(long packedDateTime)
static boolean
isWednesday(long packedDateTime)
static int
lengthOfMonth(long packedDateTime)
static int
lengthOfYear(long packedDateTime)
static int
monthsUntil(long packedDateTimeEnd, long packedDateStart)
static long
pack(short yr, byte m, byte d, byte hr, byte min, byte s, byte n)
static long
pack(LocalDate date, LocalTime time)
static long
pack(LocalDateTime dateTime)
static boolean
PM(long packedDateTime)
Returns true if the time is in the PM or "after noon".static int
time(long packedDateTIme)
static String
toString(long dateTime)
static int
yearsUntil(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)
-
-