This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes String to time stamp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "String to time stamp" Watch "String to time stamp" New topic

String to time stamp

Nagendra Shastry

Joined: Oct 26, 2010
Posts: 19

Hi all,

I have a string which has the value of a date 2013/03/12 . I want set it to a time stamp variable with same value i.e., 2013/03/12 . Can you please help?
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 15002

Use java.text.SimpleDateFormat (<= click to see the API documentation) with the appropriate format string to parse the string into a java.util.Date object.

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
I agree. Here's the link:
subject: String to time stamp
jQuery in Action, 3rd edition