Jump to content
We've recently updated our Privacy Statement, available here ×

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


selene.platt_1

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:

converted-file.png.4270d402bcc57d0226d865d2b883326b.png

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:

converted-file.png.c835fd96aa5235672fc4b9d42c31f1bd.png

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

converted-file.png.005c9f1dd20ecf376c3d3d5523fd462d.png

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...