October 31st, 2008

TIME Data

Posted by admin in F. Data Types

Like the DATE data type, the TIME data type is stored internally with hours, minutes, seconds, and optionally, with milliseconds in the ‘HH:MM:SS’ (length 8), and ‘HH:MM:SS.MMMMMM’ (up to length 15) format. A time column must have a valid time value and can not be blank. Valid values are from ’00:00:000000′ to ’23:59:59.999999′. If the column is defined as allowing NULLs, then NULL should be used for a missing time.

 

Example:    COL1 TIME

Sample value is: ’17:39.45′

 

Notice that the keyword, TIME, is a complete definition of the data type and has no value defined in parentheses.
See Sample Data Type Values.

TIME WITHOUT TIME ZONE is the same as TIME. In this course, we use TIME.

October 30th, 2008

DATE Data

Posted by admin in F. Data Types

With DATE, you no longer have to worry about one date field being defined as YYMMDD and another as MMDDYY or MM/DD/YY, and whether they are stored in binary, packed decimal, display, or alphanumeric format. All SQL DATEs are stored the same way internally, so that any DATE column can be compared to any other DATE column.

SQL DATEs can be entered or displayed in several formats, but it is stores internally so that it includes the century, year, month, and day such as ‘CCYY-MM-DD’ (with a length of 10).

A DATE column must have a valid date and can not be blank. If the columns are defined as allowing nulls, then NULL should be used for a missing date. Valid values are from ’0001-01-01′ to ’9999-12-31′.

 

Example:    COL1 DATE

 

Notice that the keyword, DATE, is a complete definition of the data type and has no value defined in parentheses.
See Sample Data Type Values.

Sample value is: ’2056-02-20′

October 29th, 2008

Date/Time/Timestamp Data, Part 2 of 2

Posted by admin in F. Data Types

Date/Time data is coded by the RDBMS vendors as follows:

Next Page »