i get time field from a database table. But may i know how to convert it into 24 hour minutes and second. simpledateformat("hhmmss") is not working. Is there any other simple java method doing it?
k_en
0
Light Poster
Recommended Answers
Jump to PostShow your code (and use code tags). Also, is it a Date, DateTime, or TimeStamp field in the Database.
Be aware though, that if your calling getDate on the field, that it will return only a Date, the time will be 00:00:00.
Jump to PostCheck the doc for SimpleDateFormat. You want to use "HHmmss" instead of "hhmmss".
Jump to PostWhat is the sql type of the column in your database?
Perhaps you can alter the query in order to format the column and return it as String:select TO_CHAR(date_col,'DD/MM/YYYY HH24 : MI : SS') from table tbl;
The date_col would be type DATE at the table and …
All 10 Replies
masijade
1,351
Industrious Poster
Team Colleague
Featured Poster
Ezzaral
2,714
Posting Sage
Team Colleague
Featured Poster
k_en
0
Light Poster
k_en
0
Light Poster
javaAddict
900
Nearly a Senior Poster
Team Colleague
Featured Poster
beelzibub
-3
Newbie Poster
javaAddict
900
Nearly a Senior Poster
Team Colleague
Featured Poster
k_en
0
Light Poster
Ezzaral
2,714
Posting Sage
Team Colleague
Featured Poster
masijade
1,351
Industrious Poster
Team Colleague
Featured Poster
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.