参考答案
占用空间
- DATETIME:8 bytes
- TIMESTAMP:4 bytes
- DATE:4 bytes
- TIME:3 bytes
- YEAR:1 byte
日期格式
- DATETIME:YYYY-MM-DD HH:MM:SS
- TIMESTAMP:YYYY-MM-DD HH:MM:SS
- DATE:YYYY-MM-DD
- TIME:HH:MM:SS
- YEAR:YYYY
最小值
- DATETIME:1000-01-01 00:00:00
- TIMESTAMP:1970-01-01 00:00:01 UTC
- DATE:1000-01-01
- TIME:-838:59:59
- YEAR:1901
最大值
- DATETIME:9999-12-31 23:59:59
- TIMESTAMP:2038-01-19 03:14:07 UTC
- DATE:9999-12-31
- TIME:838:59:59
- YEAR:2125
零值
- DATETIME:0000-00-00 00:00:00
- TIMESTAMP:1970-01-01 00:00:01 UTC
- DATE:0000-00-00
- TIME:00:00:00
- YEAR:0000
以上,是MySQL面试题【MySQL中有哪些时间字段】的参考答案。
输出,是最好的学习方法。
欢迎在评论区留下你的问题、笔记或知识点补充~
—end—