• 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:
  • Campbell Ritchie
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

converting a string into a date  RSS feed

 
Ranch Hand
Posts: 607
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am passing date as a string through a HTML form. I want to insert this string into a DATE.
I am using the following code
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
try
{
d = df.parse(weekEnding);
}
catch(ParseException e)
{
}
where weekending is a string "2004-02-02"
But I get the follwoing code:

found : java.util.Date
required: java.sql.Date
d = df.parse(weekEnding);
But I thought SimpleDateFormat passes a Java.util.Date.
Thansk for any help
Tony
 
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check your import statement.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!