The easy way to convert String to java.sql.Timestamp:
Timestamp t = new Timestamp(DateUtil.provideDateFormat().parse("2019-01-14T12:00:00.000Z").getTime());
DateUtil.java:
import java.text.SimpleDateFormat;
import java.util.TimeZone;
public interface DateUtil {
String ISO_DATE_FORMAT_ZERO_OFFSET = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'";
String UTC_TIMEZONE_NAME = "UTC";
static SimpleDateFormat provideDateFormat() {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(ISO_DATE_FORMAT_ZERO_OFFSET);
simpleDateFormat.setTimeZone(TimeZone.getTimeZone(UTC_TIMEZONE_NAME));
return simpleDateFormat;
}
}