Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

24-hour time format for s:date-tag

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I'm having trouble geting the s ate-tag to display time as an 24-hour clock ("army time"). When I set the format="hh:mm", leaving out the a-option for AM/PM, it still displays time as a 12-hour clock. Is there any option I have missed, or is there some other way around this?

Cheers, Anders
 
Ranch Hand
Posts: 643
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Anders

I used JSTL format tag and it is show date in 24 hours format

<jsp:useBean id="now" class="java.util.Date" />
<fmt:formatDate pattern="HH:mm" value="${now}" />

Can you tell in which struts library is date tag present?
I mean (bean,html,logic etc).I am not able to find it anywhere in struts tag library.

Thanks
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Anders:

Use "HH:mm" with an upper case "H", rather than "hh:mm". This is explained in the JavaDoc for the SimpleDateFormat class.

Gowher:

Anders is apparently using Struts 2, which uses <s:xxx> tags in place of those used in Struts 1.
 
Anders Sjurmann
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Gowher! The capital H-es did the trick. Stupid of me not to think of it really.

The date-tag is in Struts2. I guess I didn't mention that. Sorry.
 
My first bit of advice is that if you are going to be a mime, you shouldn't talk. Even the tiny ad is nodding:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic