What value does you pass into the 2nd parameter for the parse() method? And not sure if the locale for the SimpleDateFormat is affecting it, you may want to remove the locale to
test
.
EDIT forget the 2nd parm in parse().
K. Tsang CEng MBCS PMP PMI-ACP OCMJEA OCPJP
Jacky Luk wrote:
K. Tsang wrote:
SimpleDateFormat sdf = new SimpleDateFormat("EEE MMM dd yyyy HH:mm:ss Z");
No it doesn't work
ItDoesntWorkIsUseless
(←click).
And I wouldn't post image links. For one thing, some people may not be able to view it (and my old eyes can't read it). Post the code and your error message -
exactly
as you got it.
Winston
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found
here
// follows the cell format
SimpleDateFormat sdf =
new SimpleDateFormat("EEE MMM dd yyyy HH:mm:ss Z");
System.out.println("Date was "
+ tblSalesDetail.getValueAt(i,3).toString());
java.util.Date result =
sdf.parse(tblSalesDetail.getValueAt(i,3).toString().trim());
java.sql.Date sqlDate = new java.sql.Date(result.getTime());
ot.setWarrantyExpiryDate(sqlDate);
ot.setGrossSales((BigDecimal)tblSalesDetail.getValueAt(i,4));
ot.setQuantity(Integer.parseInt(
tblSalesDetail.getValueAt(i,5).toString()));
ot.setDiscount(Float.parseFloat(
tblSalesDetail.getValueAt(i,6).toString()));
ot.setNetSales(new BigDecimal(
tblSalesDetail.getValueAt(i,7).toString()));
No, it won't do either. I am getting this error
java.text.ParseException: Unparseable date: "Fri Aug 30 00:00:00 CST 2013"
Thanks
Jack