708 CHAPTER 28 ?– MYSQL STORAGE ENGINES AND DATATYPES
DATETIME
The DATETIME datatype is responsible for storing a combination of date and time
information. Like DATE, DATETIME values are stored in a standard format, YYYY-MM-DD
HH:MM:SS; the values can be inserted using either numbers or strings. For example,
both 20080810153510 and 2008-08-10 15:35:10 would be accepted as valid input. The
range of DATETIME is 1000-01-01 00:00:00 to 9999-12-31 23:59:59.
TIME
The TIME datatype is responsible for storing time information and supports a range
large enough not only to represent both standard and military-style time formats, but
also to represent extended time intervals. This range is ??“838:59:59 to 838:59:59.
TIMESTAMP[(M)] [DEFAULT] [ON UPDATE]
The TIMESTAMP datatype differs from DATETIME in that MySQL automatically updates it
to the current date and time whenever an INSERT or UPDATE operation affecting it is
executed. TIMESTAMP values are displayed in HH:MM:SS format, and, like the DATE and
DATETIME datatypes, you can assign values using either numbers or strings. TIMESTAMP
values can be displayed in the following formats: YYYYMMDDHHMMSS (14 digits long),
YYMMDDHHMMSS (12 digits long), YYYYMMDD (8 digits long), and YYMMDD (6 digits long). The
range of TIMESTAMP is 1970-01-01 00:00:01 to 2037-12-31 23:59:59. Its storage requirement
is four bytes.
Note that for MySQL version 4.
Pages:
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813