Great and important topic of DB2 Date/Time/Timestamp. Reference IBM.
|DATE||A date is a three-part value representing a year, month, and day in the range of 0001-01-01 to 9999-12-31.|
|TIME||A 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||A 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|
How Much Memory DB2 DATE, Time and TimeStamp Takes
- DB2 Date – takes 4 bytes.
- DB2 Time – 3 bytes.
- DB2 Timestamp – It takes 10 bytes.
DB2 – Timestamp with timezone: The format is
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