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.

Recommended Answers

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.

Jump to Post

All 3 Replies

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.

can you please show me in code ... thanks

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.