/** * Calculate the date value (in the default timezone) from a given time in * milliseconds in UTC. * * @param ms the milliseconds * @return the value */ public static ValueDate fromMillis(long ms) { return fromDateValue(DateTimeUtils.dateValueFromDate(ms)); }
/** * Get or create a date value for the given date. * * @param date the date * @return the value */ public static ValueDate get(Date date) { return fromDateValue(DateTimeUtils.dateValueFromDate(date.getTime())); }
/** * Get or create a timestamp value for the given timestamp. * * @param timestamp the timestamp * @return the value */ public static ValueTimestamp get(Timestamp timestamp) { long ms = timestamp.getTime(); long nanos = timestamp.getNanos() % 1000000; long dateValue = DateTimeUtils.dateValueFromDate(ms); nanos += DateTimeUtils.nanosFromDate(ms); return fromDateValueAndNanos(dateValue, nanos); }
/** * Get or create a timestamp value for the given date/time in millis. * * @param ms the milliseconds * @param nanos the nanoseconds * @return the value */ public static ValueTimestamp fromMillisNanos(long ms, int nanos) { long dateValue = DateTimeUtils.dateValueFromDate(ms); long timeNanos = nanos + DateTimeUtils.nanosFromDate(ms); return fromDateValueAndNanos(dateValue, timeNanos); }
/** * Get or create a timestamp value for the given date/time in millis. * * @param ms the milliseconds * @return the value */ public static ValueTimestamp fromMillis(long ms) { long dateValue = DateTimeUtils.dateValueFromDate(ms); long nanos = DateTimeUtils.nanosFromDate(ms); return fromDateValueAndNanos(dateValue, nanos); }