aspose file tools*
The moose likes JSP and the fly likes Simple way to get the current date/time into a JSP output Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Simple way to get the current date/time into a JSP output" Watch "Simple way to get the current date/time into a JSP output" New topic
Author

Simple way to get the current date/time into a JSP output

Pat Farrell
Rancher

Joined: Aug 11, 2007
Posts: 4655
    
    5

I want to display the current date/time in a JSP page. I'd like it to be formatted in the proper style for the current locale.

It looks like the taglib function "fmt:formatDate" is the right place to look, but I don't see a good place to get the
value. Clearly for some "niceDate" this will work

<fmt:formatDate value="${niceDate}" pattern="M"/>

But I don't see a good place to get a date. There clearly is a date time in the HTTP response's header, specifically something like

Date Mon, 31 May 2010 22:12:41 GMT

But I am not having luck finding how to get that into the JSP/EL context.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61191
    
  66



[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Pat Farrell
Rancher

Joined: Aug 11, 2007
Posts: 4655
    
    5

Thanks, that's simple enough
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61191
    
  66

I love simple!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Simple way to get the current date/time into a JSP output