【问题标题】:How to insert current time automatically in table in sqlite using netbeans?如何使用netbeans在sqlite的表中自动插入当前时间?
【发布时间】:2015-05-06 18:17:24
【问题描述】:

我想在 sqlite 中创建一个表,其中一个字段是用于保存当前实例的日期和时间的日期。我应该使用哪种数据类型?我打算使用“时间戳”。如何将当前时间戳值插入字段?以及如何为这个日期字段写入内容值?

【问题讨论】:

    标签: java sqlite netbeans


    【解决方案1】:

    我想这就是你想要的:

       CREATE TABLE `table` (
        ...
       `date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, 
        ...
       )
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-02-22
      • 2013-03-06
      • 1970-01-01
      • 2021-04-04
      • 2012-03-15
      • 2012-07-03
      相关资源
      最近更新 更多