We have a Sybase database that currently stores datetime values in some of the tables. If we move that server with the Sybase database to another country which is in another time zone, will the datetime values in the database be represented differently?
In other words, consider the scenario:
The Sybase database runs in timezone +2:00.
From my Java app that lives in time zone +1:00, it writes to the database 1 Jan 1970, 1:00 which is epoch 0 in the app's time zone.
preparedStatement.setTimestamp(3, new Timestamp(0));
However, when I query the database using SQL Workbench/J client (in time zone +1:00), I see
1970-01-01 01:00:00
in my table. In fact, it does not matter to which time zone I change my computer's clock, SQL Workbench/J client always reads 1970-01-01 01:00:00
from the database.
Another Java client that lives in time zone +3:00 reads the same value as
1970-01-01 01:00:00
which translates to epoch -7200000
or -2:00
in the client's time zone!
So to get back to my original question, does Sybase store datetime values as e.g. strings or epochs? I do not have a free Sybase server that I can experiment on, so what can we expect to happen when we move the server to another country with a different time zone?
The type we use is "datetime", for example:
CREATE TABLE "dbo"."whatever" (eventDate datetime NOT NULL);
Best Answer
The answer below was taken from Sybase official technical documentation available at http://www.sybase.com/detail?id=1048699 (SAP has removed support for many links at sybase.com; however The Way Back Machine seems to have a copy of the page even if it is a bit old).
I would therefore expect that changing the underlying OS timezone will not have any appreciable effect on the data stored in the
datetime
fields in your database.