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

Date / Time off by 30 minutes


joepmo

Recommended Posts

I am having an odd issue when using a Date field in iReport 3.7.6.  I am accesing a SQL Server 2005 database using a JTDS driver. 

Whenever I attempt to place a SQL date time field on my report, it is rounding the time down by 30 minutes.

For example, in the SQL table I have a field storing an EstimatedComletionDate which is populated as

2011-05-15 00:35:01.000

On iReport the date does not report as recorded in the SQL table.

If I set the field type as java.sql.Timestamp it shows - 15/05/2011 12:05 AM

If I set the field type as java.sql.Date it shows - 14/05/2011 11:30 PM

***********

I am not sure if I am having an issue with some type java conversion or with the jtds driver or something else.  Any help would be appreciated.

 

Thanks,

 

JOe

Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Have to figure it's a JTDS conversion issue.  I just tried on 3.7.6 and SQL 2008R2 (don't have SQL 2005 installed) and using JTDS driver 1.2  and everything works as expected.   I tried just pulling back a GetDate() and also a datetime column in a database, both displayed as expected with the data type set to TimeStamp. 

Which version of JTDS are you using?  I did see in the change log for JTDS that at some point they fixed a rounding issue with dates but that was around the millisecond rounding so not sure if applicable.  Might want to try version 1.2 as it has worked perfectly for me, at least to isolate whether it's JTDS.

Jeff

 

Link to comment
Share on other sites

Another option if this is really stopping you from proceeding.  Instead of passing in the datetime field, change your query to pass in a string formatted date from SQL server itself, would avoid any date conversion issues in JTDS or in iReport.  Can always convert back to a timestamp in iReport if you really need the date format.  Sometimes you just do what you have to do to get the report done :)

Jeff

 

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