public static Date toDate(Object object) { if (object instanceof Date) { return (Date) object; } else if (object instanceof Value) { return ((Value) object).dateValue(); } else if (object instanceof Calendar) { return ((Calendar) object).getTime(); } else if (object instanceof Long) { return new Date((long) object); } else if (object instanceof String) { String val = (String) object; char[] chars = FastStringUtils.toCharArray(val); if (Dates.isISO8601QuickCheck(chars)) { return Dates.fromISO8601DateLoose(chars); } else { return toDateUS(val); } } return null; }