Convert a target object to {@link Date}.

@param target
@return
432025
public static Date convertDate(Object target) {
        if (target instanceof JsonNode) {
            return convertDate((JsonNode) target);
        }
        DateFormat df = new SimpleDateFormat();
        try {
            return target instanceof Date ? (Date) target
                    : target instanceof Number ? new Date(((Number) target).longValue())
                            : target instanceof String ? df.parse(target.toString()) : null;
        } catch (ParseException e) {
            return null;
        }
    }
561211
public final void setDate(final Date date) {
		this.date = (Date) date.clone();
		dateStr = ArchiveUtils.get14DigitDate(date);
	}
311563
public static <T> Level0IndefiniteArrayOperator<T[],T> onArray(final T[] target) {
        return new Level0IndefiniteArrayOperator<T[],T>(ExecutionTarget.forOp(target, Normalisation.NONE));
    }
813492
public List<String> listUnescapeJava(final List<?> target) {
        if (target == null) {
            return null;
        }
        final List<String> result = new ArrayList<String>(target.size() + 2);
        for (final Object element : target) {
            result.add(unescapeJava(element));
        }
        return result;
    }
467401
public static Date toUtcDate(TimeZone browserTZ, TimeZone targetTZ, long localDate) {
        return toUtcDate(browserTZ, targetTZ, new Date(localDate));
    }
1244908
public static <T> Level0ArrayOperator<java.sql.Date[],java.sql.Date> onArray(final java.sql.Date[] target) {
        return onArrayOf(Types.forClass(java.sql.Date.class), target);
    }
1036109
public static final Date toDateTime_(String date) {
		try {
			return FORMAT_DATE_TIME_.parse(date);
		} catch (ParseException e) {
			throw new KnifeUtilsException(e);
		}
	}
820061
public static <T> TypeRefer of(Class<T> target) {
        return of(TypeToken.of(target));
    }
434249
public static ChronoZonedDateTime zonedTime(final Object target, final ZoneId defaultZoneId) {
        Validate.notNull(target, "Target cannot be null");
        Validate.notNull(defaultZoneId, "ZoneId cannot be null");
        if (target instanceof Instant) {
            return ZonedDateTime.ofInstant((Instant) target, defaultZoneId);
        } else if (target instanceof LocalDate) {
            return ZonedDateTime.of((LocalDate) target, LocalTime.MIDNIGHT, defaultZoneId);
        } else if (target instanceof LocalDateTime) {
            return ZonedDateTime.of((LocalDateTime) target, defaultZoneId);
        } else if (target instanceof LocalTime) {
            return ZonedDateTime.of(LocalDate.now(), (LocalTime) target, defaultZoneId);
        } else if (target instanceof OffsetDateTime) {
            return ((OffsetDateTime) target).toZonedDateTime();
        } else if (target instanceof OffsetTime) {
            LocalTime localTime = ((OffsetTime) target).toLocalTime();
            return ZonedDateTime.of(LocalDate.now(), localTime, defaultZoneId);
        } else if (target instanceof Year) {
            LocalDate localDate = ((Year) target).atDay(1);
            return ZonedDateTime.of(localDate, LocalTime.MIDNIGHT, defaultZoneId);
        } else if (target instanceof YearMonth) {
            LocalDate localDate = ((YearMonth) target).atDay(1);
            return ZonedDateTime.of(localDate, LocalTime.MIDNIGHT, defaultZoneId);
        } else if (target instanceof ZonedDateTime) {
            return (ChronoZonedDateTime) target;
        } else {
            throw new IllegalArgumentException(
                "Cannot format object of class \"" + target.getClass().getName() + "\" as a date");
        }
    }
227124
public static <T> Level0ArrayOperator<Timestamp[],Timestamp> onArray(final Timestamp[] target) {
        return onArrayOf(Types.forClass(Timestamp.class), target);
    }
1285857
public static Date copy(final Date d) {
        if (d == null) {
            return null;
        } else {
            return new Date(d.getTime());
        }
    }
144717
@Override
    public DataByteOutput<T> target(final T target) {
        return (DataByteOutput<T>) super.target(target);
    }
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);
    }
570099
public String convertDateToString(final Date date) {
        if (date == null) {
            return null;
        }
        return dateFormat.get().format(date);
    }
526179
public void update(Object target) {
        if (target == null) {
            throw new IllegalArgumentException(
                    "Target to update cannot be null");
        }

        BeanWrapper bw = new BeanWrapperImpl(target);
        bw.registerCustomEditor(Date.class, new CustomDateEditor(new SimpleDateFormat("yyyy-MM-dd"), true));
        for (Map.Entry<String, Object> property : m_properties.entrySet()) {
            String propertyName = property.getKey();
            Object value = property.getValue();

            if (value instanceof Map) {
                PropertyDescriptor pd = bw.getPropertyDescriptor(propertyName);
                if (!Map.class.isAssignableFrom(pd.getPropertyType()) || pd.getWriteMethod() == null) {
                    value = new DynamicObject((Map<String, Object>) value);
                }
            }

            if (value instanceof DynamicObject) {
                ((DynamicObject) value).update(bw.getPropertyValue(propertyName));
            }
            else {
                bw.setPropertyValue(propertyName, value);
            }
        }
    }
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;
	}
913232
public Set<String> setUnescapeJavaScript(final Set<?> target) {
        if (target == null) {
            return null;
        }
        final Set<String> result = new LinkedHashSet<String>(target.size() + 2);
        for (final Object element : target) {
            result.add(unescapeJavaScript(element));
        }
        return result;
    }