Home >> MySql >> Date and Time data types in MySql

Date and Time data types in MySql

The Following date and time data types are-

1)-DATE-A date in YYYY-MM-DD format between 1000-01-01 to 9999-12-31.

E.g.-December 30th 2001

       2001-12-30

2)-DATETIME-A date and time combination in YYYY-MM-DD HH:MM:SS format between 1000-01-01 00:00:00 to 9999-12-31.23:59:59

E.g.-3:30 in afternoon on December 30th 2001

       2001-12-30 15:30:00

3)-TIMESTAMP-A timestamp between midnight, Janury 1,1970 and some time this looks like the previous DATETIME format, only without hyphens between number YYYYMMDDHHMMSS format.

E.g.-3:30 in afternoon on December 30th 2001 would be stored as 20011230153000

4)-TIME-Stores time in HH:MM:SS format.

5)-YEAR-Stores a year 2 digits or 4 digits format.

E.g.-YEAR(2) and YEAR(4)

Post Your Comment

Next Questions
String data types
Enum data types
SET data types
Difference between varchar and char
Difference between Tinyint and smallint
Difference between enum and set
Difference between signed and unsigned
What is key
What is super key
What is candidate key
What is primary key
What is unique key
What is foreign key
What is join
What is cross join
What is natural join
What is outer join
What is self join
What is aggregate function
COUNT(*) aggregate function
AVG() aggregate function
MIN() aggregate function
MAX() aggregate function
SUM() aggregate function
STDED() aggregate function

Copyright ©2022 coderraj.com. All Rights Reserved.