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


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "formatting timestamps for display" Watch "formatting timestamps for display" New topic
Author

formatting timestamps for display

arjun rampal
Ranch Hand

Joined: Jul 08, 2005
Posts: 125
Hi on jsp using struts page I am displaying the timestamp

result-

Now rather than showing all values I wish to show only 07:20:16 means no date and no last 0 which is indiacating nanao seconds.

Now substring was option but the value returned is date here not string
[ August 31, 2006: Message edited by: Bear Bibeault ]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61434
    
  67

The JSTL <fmt:formatDate> action will allow you to specify any pattern for displaying dates and times.


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

Joined: Jan 10, 2002
Posts: 61434
    
  67

Please use more meaning subjects in future posts. I have adjusted this one on your behalf.
arjun rampal
Ranch Hand

Joined: Jul 08, 2005
Posts: 125
soory for the subject

I used <td><bean:write name="de" property="aTime" formatKey="org.apache.struts.taglib.bean.format.sql.timestamp" /></td>
and in application.properties

org.apache.struts.taglib.bean.format.sql.timestamp=hh:mm:ss

but now one problem 18:36:40 is dispaly as 06:36:40 but I want it as 18:36:40 only
Stefan Evans
Bartender

Joined: Jul 06, 2005
Posts: 1018
According to the SimpleDateFormat API you use lower case h for 12 hour time, and upper case H for 24 hour time.
ie: change your application.properties file to this:

org.apache.struts.taglib.bean.format.sql.timestamp=HH:mm:ss
arjun rampal
Ranch Hand

Joined: Jul 08, 2005
Posts: 125
ok use HH in properties file rather than hh

thanks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: formatting timestamps for display