0
我有這個示例Java代碼,我想解析一個字符串到日期,基於SimpleDateFormat上設置的模式。當我在JDK6中運行這個代碼時,它的工作正常。但在JDK7中,解析調用返回NULL。任何想法已經被JDK7改變了。這是一個已知的問題或任何解決方法?SimpleDateFormat返回NULL JDK7的日期,但與JDK6工作正常
SimpleDateFormat _theSimpleDateFormatHelper = new SimpleDateFormat();
_theSimpleDateFormatHelper.setLenient(false);
_theSimpleDateFormatHelper.applyPattern("yyyy-MM-dd hh:mm:ss");
ParsePosition parsePos = new ParsePosition(0);
Object formattedObj = _theSimpleDateFormatHelper.parse("1989-09-21 00:00:00", parsePos);