File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java DateFormat

 
vikas Gourishetty
Ranch Hand
Posts: 38
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I am trying to display the date and time.

I am using 'SimpleDateFormat' class.

---------------------------------------------------------------------------------------------------------------
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd MMM yyyy hh:mm");
String dateStr = simpleDateFormat.format(new Date());
System.out.println(+dateStr);
----------------------------------------------------------------------------------------------------------------

It is out putting: 16 Feb 2012 02:56.


Is there any way to display the date as: 16 Feb 2012 14:56

 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64196
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes. Read the javadoc for SimpleDateFormat again.
 
vikas Gourishetty
Ranch Hand
Posts: 38
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:Yes. Read the javadoc for SimpleDateFormat again.


Thanks !!
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64196
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you find it?
 
vikas Gourishetty
Ranch Hand
Posts: 38
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:Did you find it?

Not yet bro.
 
vikas Gourishetty
Ranch Hand
Posts: 38
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:Did you find it?


I tried some string patterns:

"dd MMM yyyy hh:mm" !!

need to tweak this string !!
 
vikas Gourishetty
Ranch Hand
Posts: 38
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
vikas Gourishetty wrote:
Bear Bibeault wrote:Did you find it?


I tried some string patterns:

"dd MMM yyyy hh:mm" !!

need to tweak this string !!


well: here is the tweaked string ""dd MMM yyyy HH:mm"" ..!! gone blind for an hour!!
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic