| Author |
date format problem
|
rajareddy annavaarm
Ranch Hand
Joined: Mar 15, 2007
Posts: 96
|
|
I want to display dateformat like below Mon 23 Apr 16:45 pm I am using the following code' DateFormat dateFormat = new SimpleDateFormat ("EEE MMM d hh:mm aaa"); java.util.Date date = new java.util.Date (); String dateStr = dateFormat.format (date); try{ java.util.Date date2 = dateFormat.parse (dateStr); }catch(ParseException pe){ pe.printStackTrace();} I am getting output like Sat May 16 11:37:00 GMT+05:30 1970. But I need output like Mon 23 Apr 16:45 pm. How can I do that
|
 |
Christophe Verré
Sheriff
Joined: Nov 24, 2005
Posts: 14670
|
|
Are you printing dateStr or date2 ? Try this :
|
[My Blog]
All roads lead to JavaRanch
|
 |
rajareddy annavaarm
Ranch Hand
Joined: Mar 15, 2007
Posts: 96
|
|
thanks Satou kurinosuke its working
|
 |
 |
I agree. Here's the link: jrebel
|
|
subject: date format problem
|
|
|