Friday, 5 October 2012

SQL Date Data Types

SQL Date Data Types

MySQL comes with the following data types for storing a date or a date/time value in the database:

•    DATE - format YYYY-MM-DD

•    DATETIME - format: YYYY-MM-DD HH:MM:SS

•    TIMESTAMP - format: YYYY-MM-DD HH:MM:SS

•    YEAR - format YYYY or YY

SQL Server comes with the following data types for storing a date or a date/time value in the database:

•    DATE - format YYYY-MM-DD

•    DATETIME - format: YYYY-MM-DD HH:MM:SS

•    SMALLDATETIME - format: YYYY-MM-DD HH:MM:SS

•    TIMESTAMP - format: a unique number

Note: The date types are chosen for a column when you create a new table in your database!

For an overview of all data types available, go to our complete Data Types reference.

No comments:

Post a Comment