Jump to content
Changes to the Jaspersoft community edition download ×

How to print time in 12h am/pm format?


Recommended Posts

I am trying to print a datestamp in an Excel Jaspersoft report with the time in 12-hour am/pm format. Under 'Dataset and Query', the database field (which is date format) has Class Type = java.sql.Date:


In the table, under Text Properties, I am using the format 'MM/dd/yy hh:mm a', which is supposed to give me what I want:


However, in the report, the timestamps are listed with military (24hr) time:


What am I doing wrong? I should mention that I'm defining them as dates rather than strings so the user can sort them by date in the Excel file. Thanks in advance for any help - and please give specific instructions because I am not an expert at Jaspersoft Report!

p.s. I am referring to this pattern guide: https://community.jaspersoft.com/wiki/date-and-time-patterns

Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

Thanks, I had just assumed that two m's meant a 2-digit hour, e.g. 03:00.  Interestingly, in the Excel output report, the time still looks like it's 24-hr until I click on a cell - then it appears as 12-hr. When I changed the cell formatting from Custom to Date and specified the correct format, the dates all displayed as I expected. Really odd.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...