数据库中(mysql)如何表示时间

mysql中:(datetime,date,time,timestamp,year)中各个区别

   datetime:

        格式:YYYY-MM-DD hh:mm:ss[.nnn] ,范围:1753-01-01 到 9999-12-31 ,精确度:0.00333秒 ,存储大小(以字节为单位):8 ,用户定义的秒的小数精度:无 ,时区偏移量:无

   date:

      格式:YYYY-MM-DD ,范围:0001-01-01 到 9999-12-31 , 精确度:1天 , 存储大小(以字节为单位):3 ,用户定义的秒的小数精度:无 ,时区偏移量:无

   time:

      格式:hh:mm:ss[.nnnnnnn] , 范围:00:00:00.0000000 到23:59:59.9999999 ,精确度:100 纳秒 , 存储大小(以字节为单位):3-5 ,用户定义的秒的小数精度:有 , 时区偏移量:无

   timestamp:

      格式:yyyymmddhhmmss ,范围:19700101000000 到2037 年的某个时刻 , 存储大小(以字节为单位):4

   year:

     格式:yyyy ,范围:901 到2155 , 存储大小(以字节为单位):1

https://blog.csdn.net/shubingzhuoxue/article/details/52606645

https://blog.csdn.net/m_jack/article/details/79936039

猜你喜欢

转载自blog.csdn.net/qq_41725333/article/details/82841494