Win a copy of Spring Boot in Practice this week in the Spring 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic