0

i'm trying to show date in a text field
this is what I did

java.util.Date date=new java.util.Date();
    this.DateObject.setText(date);

and its wrong... please help & thank you.

2
Contributors
3
Replies
6
Views
4 Years
Discussion Span
Last Post by JamesCherrill
1

Use the SimpleDateFormat class to convert your Date object into a String that's formatted exactly how you want to see it, and use that String in the text field.

Edited by JamesCherrill

1

We don't support people who are unwilling to put in some effort.
Look at the SimpleDateFormat doc in the Java API documentation online.
(The method you need is called format, and it's inherited from the DateFormat class).

Just look it up, it's really easy, but nobody here is going to do your homeowrk for you

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.