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