wood burning stoves*
The moose likes HTML, CSS and JavaScript and the fly likes Displaying date in a viewable format 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 » Engineering » HTML, CSS and JavaScript
Bookmark "Displaying date in a viewable format" Watch "Displaying date in a viewable format" New topic
Author

Displaying date in a viewable format

Amitav Anand
Ranch Hand

Joined: Sep 22, 2003
Posts: 46
I am trying to display a list of dates in the following format:

20 January 2005
20 March 2005
20 July 2005
20 February 2005
20 May 2005
20 June 2005

There is a method in the Java program to format the date in the above format only.. I mean keeping 3 spaces between date and month and month size is having fixed length 11.. So it will keep minimum 2 spaces between month and year.

But when its getting displayed in the browser, all the spaces are converted to one space only...
So what should I do in that formatDate() method to overcome the problem...
I tried with £ instead of blank spaces, but didn't work..
Please help me out.


Thanks in advance
Anand
Anupam Sinha
Ranch Hand

Joined: Apr 13, 2003
Posts: 1088
Please use the code tag for the dates.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60737
    
  65

Moved to the HTML forum.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60737
    
  65

Except within certain contexts (such as the body of certain tags like <pre>) multiple spaces are not significant to the browser. If you need the spaces preserved, one approach would be to use the non-breaking space HTML entity (&nbsp;) in place of space characters.
[ March 19, 2006: Message edited by: Bear Bibeault ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Displaying date in a viewable format
 
Similar Threads
Capture month and year from user input date
Dates showing up weird in to_char
Manual Calendar
Capture month and year from user input date
Capture month and year from user input date