Hi All -
Been struggling for this for the last 4 days or so...hoping someone can help.
I have a file that I am parsing dates from in the below format:
2012/58:20:36:41
2012/54:13:34:56
2012/54:15:08:16
I move these into an array (data) as a string. I want to take the string --> change it into a date object --> then print it. Clearly I am struggling with my understanding of what SimpleDateFormat does....when printing I want to maintain the same format that I have. Any and all help is appreciated. Thanks
for (int i = 0; i<data.size(); i++){ DateFormat eachDate = new SimpleDateFormat ("yyyy/DDD:HH:M:ss"); try { Date d1 = eachDate.parse(data.get(i)); System.out.println(d1); } catch(ParseException pe) { System.out.println("ERROR: could not parse date in string"); } }