title: How to use date type in weka in java code?
body: <p>I am trying to create training instances with one date attribute and one numeric attribute. I get error because of my date value.
  The error is:
  java.lang.IllegalArgumentException: Attribute neither nominal nor string!</p>
  
  <p>I guess I do not understand how to deal with this format. I have searched for it a lot but all of the examples are about using it in arff file and I couldn't find any example for java code. I will be so thankful if you could tell where I am going wrong or send me some links which could guide me through this problem.</p>
  
  <p>Here is the code:</p>
  
  <pre><code>    Attribute dateTimeAttribute = new Attribute("dateTime","yyyy-MM-dd HH:mm:ss");
      Attribute valueAttribute = new Attribute("value");
  
      FastVector fvWekaAttributesLinear = new FastVector(2);  
  
      fvWekaAttributesLinear.addElement(dateTimeAttribute);
      fvWekaAttributesLinear.addElement(valueAttribute); 
  
      Instances isTrainingSet = new Instances("Relation", fvWekaAttributesLinear, 100000); 
      isTrainingSet.setClassIndex(1);
  
      Instance ins = new Instance(2);
  
      ins.setValue((Attribute)fvWekaAttributesLinear.elementAt(0), "2009-07-15 10:00:00");
  
  
      ins.setValue((Attribute)fvWekaAttributesLinear.elementAt(1), 0.5); 
  </code></pre>