It depends entirely on the format of your String
, so I would use a SimpleDateFormat
to parse the string into a java.util.Date
; then you can extract the millisecond time value from that Date and pass it into a java.sql.Time()
. Like this:
String s = /* your date string here */;
SimpleDateFormat sdf = new SimpleDateFormat(/* your date format string here */);
long ms = sdf.parse(s).getTime();
Time t = new Time(ms);
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…