未处理的异常类型ParseException [英] unhandled exception type ParseException
本文介绍了未处理的异常类型ParseException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在我的应用程序中使用这部分代码:
I'm using this part of code in my app :
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'hh:mm:ss'Z'");
Date qdate = new GregorianCalendar(0,0,0).getTime();
try {
qdate = sdf.parse(dt);
} catch (ParseException e) {
e.printStackTrace();
}
但是Eclipse抛出错误:
but Eclipse throws an error saying :
未处理的异常类型ParseException
Unhandled exception type ParseException
这是什么问题?
您需要我发布整个代码吗?
提前Thnx!
What is the problem here? Do u need me to post the whole code ? Thnx in advance !
推荐答案
请参见下面的代码
String date = "Sat, 23 Jun 2012 00:00:00 +0000";
try {
SimpleDateFormat format = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss z");
SimpleDateFormat df2 = new SimpleDateFormat("dd/MM/yy");
date = df2.format(date));
} catch (java.text.ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
这篇关于未处理的异常类型ParseException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文