title: Create a variable Date in format "yyyy-mm-dd"
body: <p>I am trying to insert to my table, a date in format "yyyy-mm-dd". My table has a field <code>date</code> type DATETIME and I use SQLite DB SYSTEM. I need to be in this format, so later to have the option to select dates from - then. </p>
  
  <p>My table:</p>
  
  <pre><code>CREATE TABLE "IsSELECTED"(
             "date" DATETIME PRIMARY KEY  NOT NULL  DEFAULT (CURRENT_DATE) ,
             "morning" BOOL NOT NULL  DEFAULT (0) ,
             "noon" BOOL NOT NULL  DEFAULT (0) ,
             "night" BOOL NOT NULL  DEFAULT (0) 
       )
  </code></pre>
  
  <p>and the method which i am trying to insert.</p>
  
  <pre><code>        public void setTodayInfo(HttpSession session, Date date) 
              throws SQLException, ClassNotFoundException {
  
          System.out.println("Initialize today's info...");
          String sq = "INSERT INTO IsSELECTED (date, morning, noon, night) VALUES (?, ?, ?, ?)";
  
          try {       
              Class.forName(typeDB);
              c = DriverManager.getConnection(path);            
              stm = c.prepareStatement(sq);
  
              PreparedStatement stm = c.prepareStatement(sq);
  
              stm.setDate(1, date);
              stm.setBoolean(2, FALSE);
              stm.setBoolean(3, FALSE);
              stm.setBoolean(4, FALSE);
  
              int rowsAffected = stm.executeUpdate();
  
          } catch (SQLException e) { 
          System.out.println(e.getMessage());
          } finally {
          if (stm != null) {
              stm.close();
          }
          if (c != null) {
              c.close();
          }
      }          
      }
  </code></pre>
  
  <p>How can i create a variable (DATE) with the format "yyyy-mm-dd" ?</p>