This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes converting Date to String Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "converting Date to String" Watch "converting Date to String" New topic

converting Date to String

Ian Cockcroft

Joined: Feb 17, 2002
Posts: 29
Hi all,
I am converting a Date to a String to place in a textField.
How do I do this?
My code so far:
Mahesh Mamani
Ranch Hand

Joined: Jun 25, 2001
Posts: 110
Originally posted by Ian Cockcroft:

U try this
String stringOrderDate = dateOrderDate.toString();
Hope this helps...

Dirk Schreckmann

Joined: Dec 10, 2001
Posts: 7023
Here's the idea:
String stringOrderDate = dateOrderDate.toString();

Making sense?

[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
Ian Cockcroft

Joined: Feb 17, 2002
Posts: 29
100%, thanks guys.
but dont get comfortable, it wont be long before I got some more stuppid questions.
Jamie Robertson
Ranch Hand

Joined: Jul 09, 2001
Posts: 1879

if you want to format it a certain way (not just the toString() default pattern you can use a SimpleDateFormat:

I agree. Here's the link:
subject: converting Date to String
Similar Threads
iterate an object in struts-2
JDBC Help figuring it out
cannot insert datetime type
help connecting to mysql database