DB2- Date and Timestamp-Timezone

Mainframe
Mainframe

Great and important topic of DB2 Date/Time/Timestamp. Reference IBM.

DATE date is a three-part value representing a year, month, and day in the range of 0001-01-01 to 9999-12-31.
TIME time is a three-part value representing a time of day in hours, minutes, and seconds, in the range of 00.00.00 to 24.00.00.
TIMESTAMP timestamp is a seven-part value representing a date and time by year, month, day, hour, minute, second, and microsecond, in the range of 0001-01-01-00.00.00.000000000 to 9999-12-31-24.00.00.000000000 with nanosecond precision. Timestamps can also hold timezone information

DB2 Date – takes 4 bytes.

DB2 Time – 3 bytes

DB2 Timestamp – It takes 10 bytes

DB2 – Timestamp with timezone: The format is

YYYY-MM-DD.HH.MM.SS.ssssss(+|-)HH:MM

For example: 2011-05-19.10.19.00.000000-5:00

If you do not enter a value for a TIMESTAMP WITH TIME ZONE column, Optim uses the current DB2 SESSION TIME ZONE value.

DB2 Session Time: Usually local time Zone. This can be achieved by-

SET SESSION TIMEZONE as -8:00

DB2 Database Time: It is equal to CURRENT TIME ZONE

 

 

Advertisements

Author: Srini

Experienced software developer. Skills in Development, Coding, Testing and Debugging. Good Data analytic skills (Data Warehousing and BI). Also skills in Mainframe.