This week's book giveaway is in the Cloud/Virtualizaton forum.
We're giving away four copies of Mesos in Action and have Roger Ignazio on-line!
See this thread for details.
Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Displaying date in a viewable format

 
Amitav Anand
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1090
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please use the code tag for the dates.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64835
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moved to the HTML forum.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64835
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic