| Author |
How to convert Timestampformat to another format
|
kiranb reddy
Greenhorn
Joined: Sep 28, 2008
Posts: 20
|
|
Dear All,
I have a requirement to format the Timestamp format to another format, could any one explain the steps to do it.
The default timestamp format is yyyy-MM-dd HH:MM:SS
I need to fomrat it to dd-MM-yyyy HH:MM:SS
Please help to do this, and the return type must be always java.sql.TimeStamp.
Thanks in Advance.
|
 |
Christophe Verré
Sheriff
Joined: Nov 24, 2005
Posts: 14672
|
|
java.sql.TimeStamp does not hold any particular format. It just holds the date itself (the values).
If you want to format dates, you can have a look at java.text.SimpleDateFormat.
|
[My Blog]
All roads lead to JavaRanch
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19216
|
|
|
Christophe is correct. The only way to get hold of a date in a particular format is to use a String for the format.
|
SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
|
 |
 |
|
|
subject: How to convert Timestampformat to another format
|
|
|