File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes coverting a string object to a Date object Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Reply locked New topic

coverting a string object to a Date object

Kevin Brewer

Joined: Oct 04, 2003
Posts: 3
I am trying to convert a string into a integer of the Calendar object. I get an error in the following code, could anyone help
String s ="<content:collection-modifie-date/>";
SimpleDateFormat formatter = new SimpleDateFormat();
Date theDate = formatter.parse(s);
Calendar theCalendar = formatter.getCalendar();
int dayOFYear = theCalendar.get(Calendar.DAY_OF_YEAR);
Andres Gonzalez
Ranch Hand

Joined: Nov 27, 2001
Posts: 1561
Can you share the error with us?

I'm not going to be a Rock Star. I'm going to be a LEGEND! --Freddie Mercury
David O'Meara

Joined: Mar 06, 2001
Posts: 13459

You also posted a duplicate in the JSP forum which has been moved here in the Java in General (intermediate) forum.
I'm going to close this thread, people who want to help should see the other thread.
Please don't post the same question in multiple forums. It creates duplicate conversations and wastes the time of the people trying to help you.
I agree. Here's the link:
subject: coverting a string object to a Date object
jQuery in Action, 3rd edition