MySQL FAQs
FAQs Categories
Client Server Commands
Database Structure
Table Types or Storage Engines
Indexes
SQL Statements
Table Joins
Funtions and Operators
Tricky Select Queries
Speed Up Queries
Data Back Up
General Questions
Errors
1PLs Company - #1Payday.Loans Agency - Loans online and near me $100-$2500 (Same Day)
Powered by MySQL
 
Home / Database Structure / Data Types / Question No: 112

What are Temporal Data Types in MySQL?

I want to know about temporal data types in MySQL 5. Any detail please?

Answer No: 112

MySQL provides data types for storing different kinds of temporal information. The following table summarizes the storage requirements and ranges for the date and time data types.  In the following descriptions, the terms YYYY, MM, DD, hh, mm, and ss stand for a year, month, day of month, hour, minute, and second value, respectively:


                
Type Storage Required Range
DATE 3 bytes '1000-01-01' to '9999-12-31'
TIME 3 bytes '-838:59:59' to '838:59:59'
DATETIME 8 bytes '1000-01-01 00:00:00' to '9999-12-31 23:59:59'
TIMESTAMP 4 bytes '1970-01-01 00:00:00' to mid-year 2037
YEAR 1 byte 1901 to 2155 (for YEAR(4)), 1970 to 2069 (for YEAR(2))

Each temporal data type also has a "zero" value that's used when you attempt to store an illegal value. The "zero" value is represented in a format appropriate for the type (such as '0000-00-00' for DATE values and '00:00:00' for TIME) values. MySQL represents date values in 'YYYY-MM-DD' format and time values in 'hh:mm:ss' format when it displays them.

Related MySQL FAQs to the Above FAQ

What-is-BIT-Data-Type-in-MySQL What is BIT Data Type in MySQL?

What-are-numeric-data-types-in-MySQL What are numeric data types in MySQL?

What-are-integer-data-types-in-MySQL What are integer data types in MySQL?

What-are-float-data-types-in-MySQL What are float data types in MySQL?

What-is-fixed-point-and-decimal-data-type-in-MySQL What is fixed point and decimal data type in MySQL?

What-is-MySQL-default-character-set What is MySQL default character set?

What-is-difference-between-binary-and-non-binary-string-data-types What is difference between binary and non-binary string data types?

What-are-ENUM-and-SET-Data-Types-in-MySQL What are ENUM and SET Data Types in MySQL?

What-is-difference-between-CHAR-AND-VARCHAR-data-types What is difference between CHAR AND VARCHAR data types?

What-are-string-data-types-in-MySQL-5 What are string data types in MySQL 5?

How-to-reformat-date-values-in-MySQL How to reformat date values in MySQL?

How-to-reformat-Time-values-in-MySQL How to reformat Time values in MySQL?

What-are-DATE-TIME-DATETIME-and-YEAR-Data-Types-in-MySQL What are DATE, TIME, DATETIME and YEAR Data Types in MySQL?

What-is-TIMESTAMP-Data-Type-in-MySQL What is TIMESTAMP Data Type in MySQL?

About FAQs: Recently Added FAQs

About MySQL FAQs: Site Map | Bookmark Us | Recommend this Site to Your Friend | Contact Us

Useful Links: Wikipedia.org | Oracle.com | w3schools.com | www.php.net | Github.com

© 2023  www.mysqlfaqs.net
All rights reserved.