sqlite database default time value 'now'

前端 未结 7 1508
温柔的废话
温柔的废话 2020-11-27 09:28

Is it possible in a sqlite database to craete a table that has a timestamp column that default to DATETIME(\'now\') ?

Like this:

CREATE          


        
7条回答
  •  旧巷少年郎
    2020-11-27 10:08

    It is syntax error because you did not write parenthesis

    if you write

    Select datetime('now') then it will give you utc time but if you this write it query then you must add parenthesis before this so (datetime('now')) for UTC Time. for local time same Select datetime('now','localtime') for query

    (datetime('now','localtime'))

提交回复
热议问题