I have DateTime field in my Microsoft SQL Server 2008 R2 database table. I read this table in my Android application by using jtds.jdbc.Driver
successfully. But I have problem with reading correct DateTime value.
ResultSet Result = ...createStatement().executeQuery("SELECT * FROM Operation");
while (Result.next())
{
Date iDate = this.getTimestamp(Result.getDate("Timestamp"), Result.getTime("Timestamp")));
}
public Date getTimestamp(java.sql.Date date, java.sql.Time time)
{
return new Date (date.getTime() + time.getTime());
}
When I display iDate value I see that there is no timezone info. For example date in SQL server ends with time 16:51 however my diaplayed iDate has 14:51. Is there a way to get and display the exact DateTime value from the Microsoft SQL server without specifying any TimeZone value?