Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Regarding java.util.Date

 
yekkala krishna
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I need to print the date in the below format :

DD/MM/YYYY T HH:MM:SS

But i am getting exception when i use in the above format because of the character " T ".May i know any suggestion to print the date in the above format.

I am using SimpleDateFormat class to print the Date.


I am waiting for your valuable suggestions.

With Regards,
Rama krishna.Y
 
Duc Vo
Ranch Hand
Posts: 254
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just put single quote around the letter T or any other custom string that you need in the formatted string. In your case, it should be something like

"dd/MM/yyyy'T'hh:mm:ss"
[ November 23, 2008: Message edited by: Duc Vo ]
 
Campbell Ritchie
Sheriff
Posts: 48917
58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It might be easier to use the %T tags; they are listed in Formatter.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic