This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

formatting timestamps for display

 
arjun rampal
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64712
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The JSTL <fmt:formatDate> action will allow you to specify any pattern for displaying dates and times.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64712
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please use more meaning subjects in future posts. I have adjusted this one on your behalf.
 
arjun rampal
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1691
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok use HH in properties file rather than hh

thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic