列的显示格式相同
,显示宽度固定在19字符,并且格式为YYYY-MM-DD HH:MM:SS。
不同点 timestamp 1、4个字节储存(Time stamp value is stored in 4 bytes) 2、值以UTC格式保存( it stores the number of milliseconds) 3、时区转化 ,存储时对当前的时区进行转换,检索时再转换回当前的时区 4、 支持的范围为"1970-01-02 00:00:00"到"2037-12-31 23:59:59"; 如果超过此范围,在进行数据库insert或者update时,会 把一个年月日时分秒都是0的值放到表中, MySQL并不会报错,但程序可能报错 5、 可以保存1秒以下的时间 datetime 1、8个字节储存(8 bytes storage) 2、实际格式储存(Just stores what you have stored and retrieves thesamething which you have stored.) 3、与时区无关(It has nothing to deal with the TIMEZONEandConversion.) 4、 支持的范围为"1000-01-01 00:00:00"到"9999-12-31 23:59:59" |
【整理】MySQL中的datetime与timestamp比较
最新推荐文章于 2024-07-18 04:06:27 发布