Retrieving TimeZone from TimeStamp

Connectivity

Retrieving TimeZone from TimeStamp

I am using Teradata JDBC Driver (15.10.00.05).

I have created a column for a table with data type TIMESTAMP WITH TIME ZONE ( It has the time with HH:MM:SS(upto 6 digits) + Timezone

When I fetch the resulset through JDBC I am missing the precision of seconds and also the timezone.

I have tried with rs.getObject(),rs.getTimeStamp() but still I am not able retrieve the exact TIMSTAMP WITH TIMEZONE

Data in table:2015-07-23 14:05:01.073000+00:00

 Expected :2015-07-23 14:05:01.073000+00:00

 ActualResut :002015-07-23 14:05:01.073

Could someone help me in getting the exact column as it is from the Database?

1 REPLY
Teradata Employee

Re: Retrieving TimeZone from TimeStamp

The Teradata JDBC Driver User Guide has a very detailed section on working with Timestamps and Time Zones. In particular, please read the subsection titled "Receiving DATE, TIME, and TIMESTAMP Values".

http://developer.teradata.com/doc/connectivity/jdbc/reference/current/jdbcug_chapter_2.html#CHDECGBI

To summarize, you need to call the getTimestamp method with a Calendar argument. The Teradata JDBC Driver will set the Calendar argument's TimeZone object to the value of the Timestamp's time zone.