V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
geew
V2EX  ›  问与答

[MySQL] 自动当前时间戳

  •  
  •   geew · Sep 5, 2013 · 3048 views
    This topic created in 4618 days ago, the information mentioned may be changed or developed.
    知道这样的
    created timestamp not null default current_timestamp;


    获取时间戳的函数:
    select unix_timestamp();

    有没有字段为int型自动插入时间戳的呢?
    -- created int(11) not null default (当前时间戳) ???
    2 replies    1970-01-01 08:00:00 +08:00
    zzNucker
        1
    zzNucker  
       Sep 5, 2013
    应该没的吧 自动时间戳只能是timestamp类型
    qsun
        2
    qsun  
       Sep 5, 2013
    可以做个trigger, on update/insert
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5604 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 33ms · UTC 07:08 · PVG 15:08 · LAX 00:08 · JFK 03:08
    ♥ Do have faith in what you're doing.