public static Timestamp getTimestamp(Object obj) {
        if (obj == null) {
            return null;
        }
        if (obj instanceof Timestamp) {
            return (Timestamp) obj;
        } else if (obj instanceof Date) {
            return new Timestamp(((Date) obj).getTime());
        } else if (obj instanceof String) {
            return DateUtil.getTimestampFromStr(obj.toString());
        }
        throw new RuntimeException("not support type of " + obj.getClass() + " convert to Date.");
    }
Convert val to specified numeric type
Date: 2017/4/21
Company: www.dtstack.com
@author xuchao
core/src/main/java/com/dtstack/flink/sql/util/MathUtil.java