timestamp与datetime使用
来源:互联网 发布:数据统计软件 编辑:程序博客网 时间:2024/06/05 05:49
UTC一般指协调世界时
协调世界时(英:Coordinated Universal Time ,法:Temps Universel Coordonné),又称世界统一时间,世界标准时间,国际协调时间。英文(CUT)和法文(TUC)的缩写不同,作为妥协,简称UTC。
这套时间系统被应用于许多互联网和万维网的标准中,例如,网络时间协议就是协调世界时在互联网中使用的一种方式。
中国大陆、中国香港、中国澳门、中国台湾、蒙古国、新加坡、马来西亚、菲律宾、西澳大利亚州的时间与UTC的时差均为+8,也就是UTC+8。
时区(Time Zone)是地球上的区域使用同一个时间定义。1884年在华盛顿召开国际经度会议时,为了克服时间上的混乱,规定将全球划分为24个时区。在中国采用首都北京所在地东八区的时间为全国统一使用时间。
TIMESTAMP列的显示格式与DATETIME列相同。换句话说,显示宽度固定在19字符,并且格式为YYYY-MM-DD HH:MM:SS。
DATETIME以''YYYY-MM-DD HH:MM:SS''格式检索和显示DATETIME值。支持的范围为''1000-01-01 00:00:00''到''9999-12-31 23:59:59''; TIMESTAMP值不能早于1970或晚于2017
TIMESTAMP
1.4个字节储存(Time stamp value is stored in 4 bytes)
2.值以UTC格式保存( it stores the number of milliseconds)
3.时区转化 ,存储时对当前的时区进行转换,检索时再转换回当前的时区。
DATETIME
1.8个字节储存(8 bytes storage)
2.实际格式储存(Just stores what you have stored and retrieves the same thing which you have stored.)
3.与时区无关(It has nothing to deal with the TIMEZONE and Conversion.)
TIMESTAMP 默认允许为 “非空”(not null by default), 如果你在定义“ts TIMESTAMP DEFAULT NULL” 是非法的。 可以指定为空 null ,“ts TIMESTAMP NULL" ,这时可以在添加语句改变默认值。
ts2 TIMESTAMP NULL DEFAULT 0,
ts3 TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP
default (一个表中只能有一个列选择下面其中一种)
default CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
Timestamps in MySQL generally used to track changes to records, and are often updated every time the record is changed. If you want to store a specific value you should use a datetime field.
mysql 生成模板 对应的jdbcType 都是 TIMESTAMP java类型都为Date
阅读全文
0 0
- timestamp与datetime使用
- DATETIME与TIMESTAMP比较与使用
- timestamp与datetime
- mysql datetime与timestamp区别
- MySQL中的datetime与timestamp比较
- 【转】MySQL中的datetime与timestamp比较
- oracle的timestamp与sybase的datetime
- MySQL中的datetime与timestamp比较
- mysql中的datetime与timestamp比较
- MySQL中的datetime与timestamp比较
- MySQL中的datetime与timestamp比较
- MySQL中的datetime与timestamp比较
- MySQL中的datetime与timestamp比较
- MySQL中的datetime与timestamp比较
- MySQL中的datetime与timestamp比较
- MySQL中的datetime与timestamp比较
- MySQL中的datetime与timestamp比较
- MySQL中的datetime与timestamp比较
- LDAP-Apache Directory Studio使用(创建DC.OU及用户)
- 如何有效地报告Bug
- Linux系统上安装Java详细步骤
- 判断数字里是否含有某个数字的事情
- Java security之记不住的CodeBase
- timestamp与datetime使用
- 线程进阶
- 蓝桥杯练习题之特殊回文数
- 文章标题
- 如何用 TensorFlow 让一切看起来更美?
- Redis 从入门到实战
- python {}.format
- halcon的车牌识别例子
- C占位符