code: public static DateValue toDateValue(DateValue date) {
  		return (date instanceof TimeValue) ? new DateValueImpl(date.year(), date.month(), date.day()) : date;
  	}
docs: Converts the given date to a {@link DateValue} object if it is a
  {@link TimeValue} instance. If it is not a {@link TimeValue} instance,
  then the same date object is returned unchanged.
  @param date the date
  @return the date value