In MySQL databases, there are four types of Date and time: Date, DateTime, TimeStamp, Time1, and DATETIME: used when you need to include Date and time information at the same time. MySQL retrieves and displays DATETIME in YYYY-MM-DDHH: MM: SS format, with a supported range of 1000-01-0100:00:00 to 9999-12-3123: 59: 59
In MySQL databases, there are four types of Date and Time: Date, DateTime, TimeStamp, and Time 1. DATETIME type: used when you need to include Date and Time information at the same Time. MySQL retrieves and displays datetime in the 'yyyy-MM-DD HH: MM: ss' format. The supported range is '2017-01-01 00:00:00 'to '2017-12-31 23:59:59'
In MySQL databases, there are four types of Date and Time: Date, DateTime, TimeStamp, and Time
1. DATETIME type: It is used when you need to include both date and time information. MySQL retrieves and displays DATETIME values in 'yyyy-MM-DD HH: MM: ss' format, the supported range is '2017-01-01 00:00:00 'to '2017-12-31 23:59:59 '.
2. The DATE type is used when you only need the DATE value, and there is no time part. MySQL retrieves and displays the DATE value in 'yyyy-MM-DD 'format. The supported range is '2017-01-01' to '2017-12-31 '.
3. TIMESTAMP type: Provides date and time information, also displayed in 'yyyy-MM-DD HH: MM: ss' format. The difference between datetime type and datetime type is that the storage time is small, and the number of years is between 1970 and 2037. You can use it to automatically mark INSERT or UPDATE operations with the current date and time (automatically refresh when updated by default ).
4. the TIME data type indicates the TIME in a day. MySQL retrieves and displays the TIME value in the format of "HH: MM: SS. The supported range is '00: 00: 00' to '23: 59: 59 '.
Instance:
Test Table Structure:
Insert data:
View:
Update:
The timestamp field is automatically inserted.