laura.mays Posted November 18, 2020 Share Posted November 18, 2020 In a Studio report we have a table that includes a date field. When displayed in Studio there is a 12:00 a.m. timestamp added to the field.The report is populated with a query.The field in the source is datatype Date.The source is sqlServer.The connection is JDBC. The field has a class type java.sql.Date (java.util.Date provides the same results).Why is the timestamp being added? When run in different timezones this report is providing different data and it shouldn't. Link to comment Share on other sites More sharing options...
gustavofarias Posted November 19, 2020 Share Posted November 19, 2020 Why is the timestamp being added?The date type in most databases support date + time. The Date type in Java too. So it's not being added. It's just default behaviour. To prevent the time part from showing, use the "pattern" setting of the TextField using only the date part. E.g. "yyyy/MM/dd".When run in different timezones this report is providing different data and it shouldn't.The date in your database is converted to a Java Date. In Java, a Date represent a point in the time line. A point in time may be seen as different dates in different parts of the world because of time zones. The default behaviour is that dates are formatted according to the default timezone. You can change the timezone of the entire report with net.sf.jasperreports.default.timezone.See attachments. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now