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
432627
public static DateValue toDateValue(DateValue date) {
		return (date instanceof TimeValue) ? new DateValueImpl(date.year(), date.month(), date.day()) : date;
	}
776326
private DateTime zonedDateTimeToJodaTime(final ChronoZonedDateTime<?> date) {
        return date == null ? null : new DateTime(date.toInstant().toEpochMilli(), DateTimeZone.UTC);
    }
839815
public static String convertDateToDateString(Date date) {
		if (date == null) {
			return null;
		} else {
			// DateFormat df = new SimpleDateFormat("yyyy-MM-dd'Z'");
			DateTimeFormatter df = FORMATTER_DATE_Z;
			return df.print(date.getTime());
		}
	}
893499
public static Calendar calendar(Date date) {
		if(date instanceof DateTime) {
			return ((DateTime)date).toCalendar();
		}else {
			return calendar(date.getTime());
		}
	}
85996
public static CharSequence getJSDate(Date date)
	{
		Calendar calendar = Calendar.getInstance();
		calendar.setTime(date);

		return getJSDate(calendar);
	}
345343
@Override
    public Calendar convertDateToCalendar(java.util.Date date) {
        Calendar calendar = null;
        if (date != null) {
            calendar = Calendar.getInstance();
            calendar.setTime(date);
            calendar.clear(Calendar.ZONE_OFFSET);
            calendar.clear(Calendar.DST_OFFSET);
        }
        return calendar;
    }
1036109
public static final Date toDateTime_(String date) {
		try {
			return FORMAT_DATE_TIME_.parse(date);
		} catch (ParseException e) {
			throw new KnifeUtilsException(e);
		}
	}
310444
public void setDate(String date) {
        if (date == null || date.trim().isEmpty()) {
            throw new IllegalArgumentException("Date cannot be null or empty.");
        }
        try {
            Date dateToSet = new SimpleDateFormat("MM/dd/yyyy").parse(date);
            Calendar to = Calendar.getInstance();
            to.setTime(dateToSet);
            setDate(to);
        } catch (ParseException e) {
            throw new IllegalArgumentException(e);
        }
    }
1257104
public static String dateTime(Date date) {
		GregorianCalendar gc = new GregorianCalendar();
		gc.setTime(date);
		return dateTime(gc);
	}
808012
@Override
	public Long serialize(Date value) {
		if (value != null) {
			return value.getTime();
		}
		return null;
	}
27072
public static LocalDateTime dateToLocalDateTime(Date date) {

        if (date == null) {
            return null;
        }
        return LocalDateTime.ofInstant(date.toInstant(), ZoneId.systemDefault());
    }
322212
public static Date parseDate(TimeType timeType, String date) {
        SimpleDateFormat sdf = getDateFormat(timeType);
        try {
            return sdf.parse(date);
        } catch (ParseException e) {
            e.printStackTrace();
        }
        return null;
    }
1214026
public static Date getInstance(final java.util.Date date, final Value type) {
        if (Value.DATE.equals(type)) {
            return new Date(date);
        }
        return new DateTime(date);
    }
191079
public final boolean add(final Date date) {
        if (!this.isUtc() && this.getTimeZone() == null) {
            /* If list hasn't been initialized yet use defaults from the first added date element */
            if (date instanceof DateTime) {
                DateTime dateTime = (DateTime) date;
                if (dateTime.isUtc()) {
                    this.setUtc(true);
                } else {
                    this.setTimeZone(dateTime.getTimeZone());
                }
            }
        }
        if (date instanceof DateTime) {
            DateTime dateTime = (DateTime) date;
            if (isUtc()) {
                dateTime.setUtc(true);
            } else {
                dateTime.setTimeZone(getTimeZone());
            }
        } else if (!Value.DATE.equals(getType())) {
            final DateTime dateTime = new DateTime(date);
            dateTime.setTimeZone(getTimeZone());
            return dates.add(dateTime);
        }
        return dates.add(date);
    }
635335
private static Calendar getCalendar(Date date) {
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(date);
        return calendar;
    }
300162
public static String formatDate(Date date) {
        SimpleDateFormat formatter = new SimpleDateFormat(TIMESTAMP_FORMAT);
        return formatter.format(date);
    }
405853
public static Date date(String date) {
		Date result = null;
		try {
			result = getDateFormater(DATE_FORMAT, null).parse(date);
		}
		catch (ParseException pex) {
			LOG.warn("Date not constructable {}", pex, date);
		}
		return result;
	}