在sqlite3中增加日期列

时间:2014-12-17 14:08:29

标签: datetime sqlite

我有一个sqlite3表,日期存储为text not null,格式为 MM-DD-YY ,并且通过迭代光标在Java中进行了大部分操作,但是,它被证明有点丑陋/麻烦,并且我想知道是否有任何方法在sqlite3中执行更新语句以增加/减少所有记录一定天数< / strong>即可。我很难弄清楚如何将我的文本列转换为一种格式,我可以使用datetime(myDate, '+1 Day');的内容。任何人都能指出我正确的方向吗?谢谢你们!

1 个答案:

答案 0 :(得分:0)

documentation of the built-in date functions记录支持的日期格式:

  

YYYY-MM-DD

您应该以这种格式存储日期值 如果你不能这样做,你可以use substr() to extract the fields of the date and convert it into the supported format