0
orders[index][6]=rs.getDate("dateArriving");
SimpleDateFormat formattedDate = new SimpleDateFormat("yyyy-MM-dd");                       
orderDate = formattedDate.parse(orderDateCon);

This is my line for getting the date and this is what i use to store the date:

so when i print orderDate, i get a result like this: Thu Nov 26 00:00:00 GMT 2015 I want the date to be printed so that the result is only Thu Nov 26 20125, without 00:00:00. +extra question, how to get the 00:00:00 to be stored in a normal way, because the time should be, for example, if the date is stored now, Thu Nov 26 22:14:50 GMT 2015

Explaining the question in more details:

....code....

String orderDateCon = menu.ordersList.get(y).getOrderDate().toString();

....code....

while(y < menu.ordersList.size())
                {
                    formattedDate.format(formattedDate.parse(orderDateCon));
                        orderData[y][0] = (menu.ordersList.get(y).getProductName()); 
                        orderData[y][1] = (menu.ordersList.get(y).getQuantity()); 
                        orderData[y][2] = (menu.ordersList.get(y).getProductCost()); 
                        orderData[y][3] = (menu.ordersList.get(y).getTrademark()); 
                        orderData[y][4] = formattedDate.format(formattedDate.parse(orderDateCon));//(menu.ordersList.get(y).getOrderDate()); 
                        orderData[y][5] = (menu.ordersList.get(y).getArriveDate()); 


                        y++;
            }

This code i use to store the data into a table, but this error i get: java.text.ParseException: Unparseable date: "Thu Nov 26 00:00:00 GMT 2015"

Peter Lawrey
  • 525,659
  • 79
  • 751
  • 1,130
  • Possible duplicate of [display Java.util.Date in a specific format](http://stackoverflow.com/questions/6262310/display-java-util-date-in-a-specific-format) – gtgaxiola Dec 10 '15 at 22:18
  • Use a DateFormat of some kind to print the date value in the format you want. Date is just s container for the number of milliseconds since the UNIX epoch – MadProgrammer Dec 10 '15 at 22:27

1 Answers1

0

You should use a query like this:

select to_char(dateArriving, 'YYYY-mm-dd') as dateArriving from tablename ;
PeterSW
  • 4,921
  • 1
  • 24
  • 35
Oak
  • 1