Re: date in format yy-mm-dd hh:mm



Sigi wrote:
I have a Date object, and I need to obtain it in a human readable format.
If I use date.toString(), it gives:
Fri Jan 26 17:47:57 CET 2007

What can I do to obtain it in the
07-01-26 17:47
format?
DateFormat dateFormat = new SimpleDateFormat("yy-MM-DD HH:mm");
// You'll find more info about the pattern strings
// in the API doc of SimpleDateFormat

Date date = ...;
String s = dateFormat.format(date);

--
Thomas
.