0

I know i have to use SimpleDateFormat but I can't parse a date into the desire format.

My input from a .txt file are stock like this: 2015-09-01 00:10:21.863 and here's my code.

public class RequestList { 
   private ArrayList<Request> reqList = new ArrayList<>(); 
   SimpleDateFormat reqDF = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); 
   private Request r = new Request();

public ArrayList load_request_list(String filename)  throws Exception
{
    reqList.clear(); //Arraylist with every request from filename
    BufferedReader br =  new BufferedReader(new FileReader(filename));
    String ligne = br.readLine(); // first line read
    ligne = br.readLine(); //second line read
    String [] tab2 = ligne.trim().split(";");
    while(tab2 != null)
    {
        req.reception_time = reqDF.parse(tab2[3]); 
        ...
     }

And in my main, when i try to read req.reception_time, my output is:

Tue Sep 01 00:15:28 EDT 2015

Is this because reception_time is build as a Date ? Thank you !

0 Answers0