Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds this week in the Cloud/Virtualization forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

Parsing dates with dashes  RSS feed

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone,

This might sound like a trivial problem, I personally never thought I would have a problem parsing dates, but it seems like the SimpleDateFormat class does not like dashes.

SimpleDateFormat format = new SimpleDateFormat("dd-MM-yyyy");
System.out.println(format.parse("24-09-1976"));

java.text.ParseException: Unparseable date: "24-09-1976"

at java.text.DateFormat.parse(DateFormat.java:319)

at test.TestMisc.testDateParse(TestMisc.java:12)

at test.TestMisc.main(TestMisc.java:21)

Please help.
 
Ranch Hand
Posts: 1281
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i found no prob whatsoever:

Fri Sep 24 00:00:00 BST 1976

 
Ranch Hand
Posts: 172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Even I didn't find any problem when I replied to the same question on Sun's forum. Maybe there is some older class file creating the problem.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!