• Post Reply Bookmark Topic Watch Topic
  • New Topic

Date Converting String to Date  RSS feed

 
Ranch Hand
Posts: 495
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In my application to convert from String to Date

I have the following



It works problem is , the compiler shows a warning that the Constructor new Date(String) is deprecated, please can some one suggest an alternative way to convert from String to date
 
Ranch Hand
Posts: 334
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use DateFormat or SimpleDateFormat instead of Date.

 
Rancher
Posts: 2240
28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Haven't got a code example for you, but here is how you could lookup how to do it. In the java API doc, look at the Index (one of the links at the top of the doc page) for the parse() method. If you scan down thru all the different parse methods you'll see one that returns a Date object.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!