File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

date format problem

 
rajareddy annavaarm
Ranch Hand
Posts: 96
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you printing dateStr or date2 ?
Try this :
 
rajareddy annavaarm
Ranch Hand
Posts: 96
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks Satou kurinosuke
its working
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic