Opening of the line at the date



  • 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 a password is recorded, why the format is translated into a different format and always recorded in the format and values of Sun Dec 27 00:00 AMT 2015.



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

    This line you indicate where your line will contain part of the date. For a sausage.

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

    And line formats the date into the format you need. And the line will be returned.


Log in to reply
 


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2