• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Parsing date exception

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

When I am running this code, it calls the readCSV class



And I am getting the parse date exception. I am new to java. I just want to learn certain things.... Thanks in advance for the help
The error which I am getting is


 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch.

That's a lot of code to wade through!

It looks like your program is expecting a date in the format "yyyy-MM-dd" (4 digits year, a '-' character, 2 digits month, a '-' character and 2 digits day) because that's what you specified when making the SimpleDateFormat object.

A date like "8/4/1955" does not look like the format "yyyy-MM-dd". It should have been "1955-04-08". Or you should have specified a different format when creating the SimpleDateFormat object, for example "dd/MM/yyyy". (Is it month/day or day/month?).
 
Marshal
Posts: 8857
637
Mac OS X VI Editor BSD Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thaiyalnayaki Kathiresan, welcome to the Ranch.

Please UseCodeTags (<-- link) when you posting code, in that way it is much easier to read it.
I have added them for you this time, see how better it looks?
 
Marshal
Posts: 79180
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome again

Why are you writing your own CSV parser when there are parsing libraries available and you can use factory methods like this one or this one? What does epoch++ mean on line 169?
 
snakes are really good at eating slugs. And you wouldn't think it, but so are tiny ads:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic