• 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
  • Liutauras Vilda
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Devaka Cooray
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Tim Holloway
  • Claude Moore
  • Stephan van Hulst
Bartenders:
  • Winston Gutkowski
  • Carey Brown
  • Frits Walraven

converting a string into a date  RSS feed

 
Ranch Hand
Posts: 630
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.
 
sunglasses are a type of coolness prosthetic. Check out the sunglasses on this tiny ad:
Become a Java guru with IntelliJ IDEA
https://www.jetbrains.com/idea/
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!