【问题标题】:SQLite Date QuerySQLite 日期查询
【发布时间】:2011-01-30 08:50:25
【问题描述】:

我正在尝试获取某个日期范围内一个孩子的所有记录,但我什么也没得到,让人相信我构造了错误的查询。

DateTime t = child.DOB.AddMonths (36);
string sql = "
  select * from MeasurementEntity 
  where ChildFK=? and date<=? order by date";
var q = db.Query<MeasurementEntity> (sql,child.PK, t.ToShortDateString ());

这是 C#,但这与答案无关。

【问题讨论】:

    标签: c# sql sqlite


    【解决方案1】:

    也许数据时间格式有问题。尝试使用 ISO8601:

    var q = db.Query<MeasurementEntity>(sql,child.PK, t.ToString("s"));
    

    【讨论】:

      猜你喜欢
      • 2012-10-13
      • 1970-01-01
      • 2019-10-14
      • 1970-01-01
      • 2014-09-22
      • 1970-01-01
      • 2019-04-16
      • 1970-01-01
      相关资源
      最近更新 更多