title: Java - How to write a time stamp to a text file?
body: <p>I'm making this Login bit to a larger program, and I want to save the time of when a failed login happens and save the timestamp to a file called FailedLogins.txt. The problem is,<strong>"No suitable method found for write(Timestamp)</strong>", when I put the time stamp variable in the fwriter.write().</p>
  
  <pre><code>try {
          writer = new BufferedWriter( new FileWriter("UserPass.txt"));
          fwriter = new BufferedWriter( new FileWriter("FailedLogins.txt"));
  
          if(ppassword.equals(rrepassword)) {
  
              writer.write("Name: " + ffname + " " + llname + "\n");
              writer.write("Email: " + eemail + "\n");
              writer.write("Password: " + ppassword + "\n\n");
          }
          else {
              password.setText("");
              repassword.setText("");
              JOptionPane.showMessageDialog(null, "Your passwords do not match.");
  
              //For Failed Logins text File
              Timestamp timestamp = new Timestamp(System.currentTimeMillis());
              fwriter.write(timestamp);
          }
  
      }
      catch ( IOException e) {
      }
      finally {
          try {
              if ( writer != null) {
                  writer.close( );
              }
          }
          catch ( IOException e) {
          }
      }
  </code></pre>
  
  <p>Any Ideas?</p>