0
当我在java中解析时间时,我传递“12:12”作为字符串参数,然后我得到“Thu Jan 01 12:12:00 IST 1970”作为输出。在java中的日期格式问题
我希望当前年度像“Fri Mar 09 12:12:00 IST 2012”作为输出。
String timestr = "12:12";
Date convertedDate = null;
try {
SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm");
convertedDate = dateFormat.parse(timestr);
} catch (ParseException e) {
e.printStackTrace();
}
System.out.println(convertedDate);
谢谢!
接受您的问题! – epoch 2012-03-09 08:09:05