ITPub博客

首页 > > > mysql的TIMESTAMP最多支持6位小数(微秒)

mysql的TIMESTAMP最多支持6位小数(微秒)

作者:zuike2000 时间:2020-07-03 09:20:54 0 删除 编辑

ADATETIMEorTIMESTAMPvalue can include a trailing fractional seconds part in up to microseconds (6 digits) precision. In particular, any fractional part in a value inserted into aDATETIMEorTIMESTAMPcolumn is stored rather than discarded. With the fractional part included, the format for these values is'YYYY-MM-DD hh:mm:ss[.fraction]', the range forDATETIMEvalues is'1000-01-01 00:00:00.000000'to'9999-12-31 23:59:59.999999', and the range forTIMESTAMPvalues is'1970-01-01 00:00:01.000000'to'2038-01-19 03:14:07.999999'. The fractional part should always be separated from the rest of the time by a decimal point; no other fractional seconds delimiter is recognized.

MySQL has fractional seconds support for TIME, DATETIME, and TIMESTAMP values, with up to microseconds (6 digits) precision。

  • To define a column that includes a fractional seconds part, use the syntax type_name(fsp), where type_name is TIME, DATETIME, or TIMESTAMP, and fsp is the fractional seconds precision. For example:
    CREATE TABLE t1 (t TIME(3), dt DATETIME(6));
    The fsp value, if given, must be in the range 0 to 6. A value of 0 signifies that there is no fractional part. If omitted, the default precision is 0. (This differs from the standard SQL default of 6, for compatibility with previous MySQL versions.)

原文作者:;如有侵权,请联系管理员删除。

请登录后发表评论 登录
全部评论

注册时间:2019-04-16

  • 博文量
    404
  • 访问量
    2073