This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

to convert string to date  RSS feed

 
anupama rc
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
pls help me out with this problem....i am accepting the date as a string thro an html form and want to convert into date object.....

------------------
anu
 
Peter den Haan
author
Ranch Hand
Posts: 3252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by anupama rc:
pls help me out with this problem....i am accepting the date as a string thro an html form and want to convert into date object.....

I don't quite understand this. One of the very first sentences in the javadoc for Date is: As of JDK 1.1, the Calendar class should be used to convert between dates and time fields and the DateFormat class should be used to format and parse date strings.
One of the examples given in the introduction to the DateFormat class is: You can use a DateFormat to parse also.
   myDate = df.parse(myString);

If you don't have the JDK documentation installed on your machine, then please fix this.
Besides, this question has nothing whatsoever to do with servlets and JSPs. If you're reading documentation anyway you might want to read this as well.
- Peter
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!