[This is a multi-post; I thank you people for the attention]

hi

How could I show a database datetime field (like mm/dd/yyyy) on a JTextField?

regards

Recommended Answers

All 2 Replies

You can use string tokenizer or split method of string to format the input string like dd/mm/yy...then you put it as normal string in jtextfield....

[This is a multi-post; I thank you people for the attention]

hi

How could I show a database datetime field (like mm/dd/yyyy) on a JTextField?

regards

2 ways:
> Read it from the database using: ResultSet.getDate(), and store that value into a java.util.Date object. Then use java.text.SimpleDateFormat

> Read it as text from the query and then just display it:

select to_char(date_column,'DD/MM/YYYY HH24:MI:SS'), other_columns
from ....

You can use whatever format you want. Then read that column using ResultSet.getString()

Be a part of the DaniWeb community

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