-3
String str_date = currentMonth + 1 + "-" + value.toString() + "-" + currentYear;
DateFormat formatter ;
Date date = null ;
formatter = new SimpleDateFormat("dd-MMM-yy");
try {
date = (Date)formatter.parse(str_date);
}
catch (ParseException e) {
e.printStackTrace();
}
System.out.println(date);
嗨,我试图搜索字符串到目前为止,几乎每个人都使用这种类型的代码,但它似乎仍然打印出空?谢谢。当前解析字符串
在解析之前,你看过'str_date'中的实际内容吗? –
请不要这样做。这在很多方面都是错误的。 – duffymo
...一旦你这样做了,也许可以使用格式化程序来格式化一个实际的日期('new Date()'),以确保你看到的与你期望的一致 –