/** {@inheritDoc} */ @Override public Value value(GridKernalContext ctx) { return ValueDate.fromDateValue(date); }
/** * 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())); }
/** * Parse a string to a ValueDate. * * @param s the string to parse * @return the date */ public static ValueDate parse(String s) { try { return fromDateValue(DateTimeUtils.parseDateValue(s, 0, s.length())); } catch (Exception e) { throw DbException.get(ErrorCode.INVALID_DATETIME_CONSTANT_2, e, "DATE", s); } }
/** * Convert a java.util.Date using the specified calendar. * * @param x the date * @param calendar the calendar * @return the date */ public static ValueDate convertDate(Date x, Calendar calendar) { if (calendar == null) { throw DbException.getInvalidValueException("calendar", null); } Calendar cal = (Calendar) calendar.clone(); cal.setTimeInMillis(x.getTime()); long dateValue = dateValueFromCalendar(cal); return ValueDate.fromDateValue(dateValue); }
/** * Converts a LocalDate to a Value. * * @param localDate the LocalDate to convert, not {@code null} * @return the value */ public static Value localDateToDateValue(Object localDate) { try { return ValueDate.fromDateValue(dateValueFromLocalDate(localDate)); } catch (IllegalAccessException e) { throw DbException.convert(e); } catch (InvocationTargetException e) { throw DbException.convertInvocation(e, "date conversion failed"); } }
if (!forceTimestamp) { if (original instanceof ValueDate) { return ValueDate.fromDateValue(dateValue);
return LocalDateTimeUtils.valueToLocalDate(ValueDate.fromDateValue( DateTimeUtils.dateValueFromDate(((Date)val).getTime())));
return ValueDate.fromDateValue(PageUtils.getLong(pageAddr, off + 1));
return ValueDate.fromDateValue(readVarLong(buff));
/** {@inheritDoc} */ @Override public Value value(GridKernalContext ctx) { return ValueDate.fromDateValue(date); }
/** * 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())); }
/** * 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())); }
/** * 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)); }
/** * Convert a java.util.Date using the specified calendar. * * @param x the date * @param calendar the calendar * @return the date */ public static ValueDate convertDate(Date x, Calendar calendar) { if (calendar == null) { throw DbException.getInvalidValueException("calendar", null); } Calendar cal = (Calendar) calendar.clone(); cal.setTimeInMillis(x.getTime()); long dateValue = dateValueFromCalendar(cal); return ValueDate.fromDateValue(dateValue); }
/** * Convert the date using the specified calendar. * * @param x the date * @param calendar the calendar * @return the date */ public static ValueDate convertDate(Date x, Calendar calendar) { if (calendar == null) { throw DbException.getInvalidValueException("calendar", null); } Calendar cal = (Calendar) calendar.clone(); cal.setTimeInMillis(x.getTime()); long dateValue = dateValueFromCalendar(cal); return ValueDate.fromDateValue(dateValue); }
/** * Parse a string to a ValueDate. * * @param s the string to parse * @return the date */ public static ValueDate parse(String s) { try { return fromDateValue(DateTimeUtils.parseDateValue(s, 0, s.length())); } catch (Exception e) { throw DbException.get(ErrorCode.INVALID_DATETIME_CONSTANT_2, e, "DATE", s); } }
/** * Parse a string to a ValueDate. * * @param s the string to parse * @return the date */ public static ValueDate parse(String s) { try { return fromDateValue(DateTimeUtils.parseDateValue(s, 0, s.length())); } catch (Exception e) { throw DbException.get(ErrorCode.INVALID_DATETIME_CONSTANT_2, e, "DATE", s); } }
return LocalDateTimeUtils.valueToLocalDate(ValueDate.fromDateValue( DateTimeUtils.dateValueFromDate(((Date) val).getTime())));