Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to display current date

 
Aparna Ram
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I would like to know how to display the current date in a jsp page using jsp tags.
Using getProperty name and property, the month gets displayed from 0 to 11 and the year- the current year minus 1900.
How do I get to display a date in this format:
21. March 2006

Thanks in advance
Regards
Aparna
 
Kj Reddy
Ranch Hand
Posts: 1704
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to use java.text.DateFormat
 
Aparna Ram
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
Thanks for the reply. I was wondering if the following would work. But it does not. Can you suggest me how?



TIA,
Aparna
 
Kj Reddy
Ranch Hand
Posts: 1704
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Aparna Ram:
hi,
Thanks for the reply. I was wondering if the following would work. But it does not. Can you suggest me how?



TIA,
Aparna


Not sure, but it may not give you resupts as you expected. Look at this thread on dateformatting in JSP:
http://www.coderanch.com/t/379427/java/java/Date-Formatting
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64838
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Best option is to use the JSTL <fmt:formatDate> tag.
 
Aparna Ram
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
I am new to the JSP world.
can you provide me some more tips on that idea of JSTL?

TIA,
Aparna
 
Kj Reddy
Ranch Hand
Posts: 1704
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Aparna Ram:
hi,
I am new to the JSP world.
can you provide me some more tips on that idea of JSTL?

TIA,
Aparna


look at this link:
http://www.onjava.com/pub/a/onjava/2002/09/11/jstl2.html
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64838
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Be aware that that's a rather old article at this point. With JSP 2.0 you should be using JSTL 1.1.

See the JSP FAQ for a link to the JSTL 1.1 Specification.
 
Kj Reddy
Ranch Hand
Posts: 1704
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also look here for JSTL introduction:

http://java.sun.com/j2ee/1.4/docs/tutorial/doc/JSTL.html#wp74644
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic