code: public static Long toLong(Object value) {
          if (value == null) {
              return null;
          } else if (value instanceof Long) {
              return (Long) value;
          } else if (value instanceof Number) {
              return ((Number) value).longValue();
          } else if (value instanceof java.util.Date) {
              return ((java.util.Date) value).getTime();
          } else {
              try {
                  return Long.valueOf(value.toString().trim());
              } catch (NumberFormatException e) {
                  throw new ConversionException("failed to convert: '" + value + "' to Long", e);
              }
          }
      }
docs: Converts value to <code>Long</code> if it can. If value is a <code>Long</code>, it is returned, if it is a <code>Number</code>, it is
  promoted to <code>Long</code> and then returned, if it is a <code>Date</code>, returns its getTime() value, in all other cases, it converts the value to String,
  then tries to parse Long from it.
  
  @param value value to be converted to Long.
  @return value converted to Long.