Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Beginning Java and the fly likes Regarding java.util.Date Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Regarding java.util.Date" Watch "Regarding java.util.Date" New topic
Author

Regarding java.util.Date

yekkala krishna
Ranch Hand

Joined: Mar 04, 2007
Posts: 105
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

Joined: Nov 20, 2008
Posts: 254
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 ]

“Everything should be as simple as it is, but not simpler.” Albert Einstein
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 37902
    
  22
It might be easier to use the %T tags; they are listed in Formatter.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Regarding java.util.Date
 
Similar Threads
How to change Date Format
f:convertDateTime not working
String to date conversion in java
How to write errors to a file using Log4j.Properties
java.util.Calendar