Home > Backend Development > PHP Tutorial > mysql中date与datetime的区别是什么

mysql中date与datetime的区别是什么

PHPz
Release: 2020-06-24 16:17:42
Original
2868 people have browsed it

mysql中date与datetime的区别是什么

mysql中date与datetime的区别

date类型可用于需要一个日期值而不需要时间部分时。MySQL 以 'YYYY-MM-DD' 格式检索与显示date值。支持的范围是 '1000-01-01' 到'9999-12-31'。

datetime类型可用于需要同时包含日期和时间信息的值。MySQL 以 'YYYY-MM-DD HH:mm:ss'格式检索与显示 DATETIME 类型。

支持的范围是'1000-01-0100:00:00' 到 '9999-12-3123:59:59'。(“支持”的含义是,尽管更早的值可能工作,但不能保证他们均可以。)

若mysql中指定字段类型是DateTime,则后台TimeStamp timeStamp=new TimeStamp(new Date.getTime)或Date date=new Date();

并且mybatis中:mapper.xml里JDBCType=TIMESTAMP---->这才是重点

推荐视频教程:mysql视频教程

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template