This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

converting string datetime object to date object.

 
amarshi mohanty
Ranch Hand
Posts: 110
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

How to convert string date_time object to Date object.


 
Varun Chopra
Ranch Hand
Posts: 211
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
amarshi mohanty wrote:Hi,

How to convert string date_time object to Date object.



Look at java.text.DateFormat and parse method
 
Amit Vinod Dali
Ranch Hand
Posts: 42
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
import java.text.SimpleDateFormat;
import java.util.Date;


try
{
SimpleDateFormat dateDisplayFormat = new SimpleDateFormat("dd/MM/yyyy");
Date date = dateDisplayFormat.parse("2010-58-14 03:58:02");
}
catch (ParseException pe)
{
// Handle Exception here
}
 
Rob Spoor
Sheriff
Pie
Posts: 20393
46
Chrome Eclipse IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Amid, please UseCodeTags. Also, that code won't work. The pattern clearly does not match the provided string.
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Pie
Posts: 15150
31
Android IntelliJ IDE Java Scala Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
amarshi mohanty wrote:

That date looks really strange. What is it supposed to mean? The 14th day of the 58th month of 2010? Or the 58th day of the 14th month of 2010?
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic