aspose file tools*
The moose likes JSP and the fly likes how to display current date Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "how to display current date" Watch "how to display current date" New topic
Author

how to display current date

Aparna Ram
Ranch Hand

Joined: Jan 27, 2006
Posts: 59
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

Joined: Sep 20, 2003
Posts: 1704
You need to use java.text.DateFormat
Aparna Ram
Ranch Hand

Joined: Jan 27, 2006
Posts: 59
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

Joined: Sep 20, 2003
Posts: 1704
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

Joined: Jan 10, 2002
Posts: 60072
    
  65

Best option is to use the JSTL <fmt:formatDate> tag.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Aparna Ram
Ranch Hand

Joined: Jan 27, 2006
Posts: 59
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

Joined: Sep 20, 2003
Posts: 1704
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

Joined: Jan 10, 2002
Posts: 60072
    
  65

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

Joined: Sep 20, 2003
Posts: 1704
Also look here for JSTL introduction:

http://java.sun.com/j2ee/1.4/docs/tutorial/doc/JSTL.html#wp74644
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to display current date
 
Similar Threads
how to get yesterdays date using jsp
compare year and date ??
EL functions and singleton session bean
XSD : default current date
How to insert date values to database using java swings