Results 1 to 5 of 5
  1. #1
    Join Date
    Feb 2013
    Posts
    3

    Unanswered: Timestamp timezone in Control Center

    Hi all!
    First time I am posting in this forum, hope you can help.

    Some info on my system:
    ---
    Win7, 64bit

    Product name: "DB2 Enterprise Server Edition"
    License type: "Restricted"
    Expiry date: "Permanent"
    Product identifier: "db2ese"
    Version information: "9.7"

    DB21085I Instance "DB2" uses "64" bits and DB2 code release "SQL09071" with level identifier "08020107".
    Informational tokens are "DB2 v9.7.100.177", "s091114", "IP23029", and Fix Pack "1".
    ---

    The question is, I have a table with a field of type TIMESTAMP, what timezone is used to show this time in control center? Google says that it should be my local system timezone, but I changed the system timezone manually, restart the computer, and the date was not changed.

    On the other hand
    "select current timestamp from sysibm.sysdummy1"
    returns correct local time, and changes with local timezone change.

    Thanks!

  2. #2
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    DB2 will not convert a stored timestamp value, neither will the Control Center. If the timestamp is UTC, you can convert it to the local timezone by doing this:

    select mytstamp - current timezone from mytable
    ---
    "It does not work" is not a valid problem statement.

  3. #3
    Join Date
    Feb 2013
    Posts
    3
    Thank you for the reply.

    Please let me know that I understand correctly.

    TIMESTAMP type does not have timezone assigned to it. DB2 does not add/subtract anything to the value before showing it. Therefore the time actually shown in control center is effectively UTC.

  4. #4
    Join Date
    Feb 2013
    Posts
    3
    I probably mix Java Timestamp and DB2 Timestamp concepts...

    Java Timestamp represents a physical moment, and as such requires timezone each time it is represented in days and hours format.

    DB2 is the opposite, it stores the days and hours. It can be shown no problem, like in control center, but it requires timezone to derive the physical moment from it.

    Could you please confirm or correct.

  5. #5
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    Both java.sql.Timestamp and the DB2 TIMESTAMP datatype are timezone-agnostic. If you initialize either with a value, it's up to you to know whether that value reflects UTC or some local time. Subsequently, when you retrieve either value, it's up to you to adjust it to whatever timezone you want, based on your knowledge of the initial value context.
    ---
    "It does not work" is not a valid problem statement.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •