• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem with parsing a SQLite date string.

 
Jacky Luk
Ranch Hand
Posts: 634
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

The result in the java.util.Date object is something which looks like this
Sun Dec 30 00:00:00 CST 2012

As I'd expect it to be 2013-06 with a 6 in the variable i.
Any help would be greatly appreciated.
Thanks
Jack
 
E Armitage
Rancher
Posts: 989
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1.) Year is represented by a small y not capital Y. The the docs for the SimpleDateFormat class for examples.
2.) If you are getting the date as a String then why do you need to parse it to a util.Date if you want to display the Date as String? To display the date as a String you would have to use the format method.
3.) You are doing the parse inside the while loop, right?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic