• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Bean:write + formatting dates

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

I am trying to format a date. I need a lowercase pm/am at the ned of it depending on whats returned to me. I am currently using the following. My issues is that the 'a' returns the PM/AM in uppercase and not lowercase. Any ideas on how I can get it to be displayed in lowercase?

<bean:write name='ftne' property='asofDate' format='MM/dd/yyyy hh:mma' />

Thanks,
Sarah
 
Sheriff
Posts: 6450
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The bean:write tag uses java.text.SimpleDateFormat to format Dates when using the format property of the tag. SimpleDateFormat only returns AM or PM in upper case.

One suggestion would be to give your "ftne" bean a getFormattedAsOfDate() method which would return the date in the format you prefer if SimpleDateFormat is insufficient as is. Then just have the <bean:write> tag reference the formattedAsOfDate property.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic