presto-jdbc/src/main/java/io/prestosql/jdbc/ObjectCasts.java/ObjectCasts/castToTimestamp
class ObjectCasts:    public static Timestamp castToTimestamp(Object x, int targetSqlType)
            throws SQLException
    {
        if (x instanceof Timestamp) {
            return (Timestamp) x;
        }
        if (x instanceof java.util.Date) {
            return new Timestamp(((java.util.Date) x).getTime());
        }
        if (x instanceof LocalDateTime) {
            return Timestamp.valueOf((LocalDateTime) x);
        }
        try {
            if (x instanceof String) {
                return Timestamp.valueOf((String) x);
            }
        }
        catch (RuntimeException e) {
            throw invalidConversion(x, targetSqlType, e);
        }
        throw invalidConversion(x, targetSqlType);
    }