DateFormat date_format = new SimpleDateFormat("MM/dd/YYYY", Locale.ENGLISH); private JFormattedTextField product_in_date = new JFormattedTextField(date_format); try { listsShield.getStorelist() .add( new StoreList().greateStoreListIn( listsShield.getStorelist().size(), (String) product_name.getSelectedItem(), product_articul.getText(), product_specefication.getText(), date_format.parse(product_in_date.getText()), Integer.parseInt(product_in_count.getText()) ) ); } catch (NumberFormatException | ParseException e1) { e1.printStackTrace(); } cleareTextField(); try { inFile.writeToFileStore(); } catch (IOException e1) { } 

The problem is that when writing to a sheet a parser for some reason, the format translates into some other format, and it is always written to it in the format and values ​​of Sun Dec 27 00:00:00 AMT 2015.

    1 answer 1

     DateFormat date_format = new SimpleDateFormat("MM/dd/yyyy", Locale.ENGLISH); 

    With this line you specify where in your line parts of the date will be located. For parsing.

     System.out.println(new SimpleDateFormat("MM/dd/yyyy") .format(date_format.parse("12/30/2015"))); 

    And this line formats the date in the format you want. And the string will be returned.

    • If the answer solves the problem, please tick it with a green check mark. - DimXenon