File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
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
It's not a secret anymore!