2017-04-02 82 views
0

我与它包含字段,“日期时间”表中的源码,Android平台,Android的插入日期到日期时间SQLite的

我试图在表中插入值和:

ContentValues cvv = new ContentValues(); 

      cvv.put("viatge_id",v.getId()); 
      .... 
      cvv.put("time",s.getDate()); 

s.getDate返回一个Date元素。但似乎我不能使用我告诉你的最后一条指令

+0

哪个[SQLite的日期类型(http://www.sqlite.org/datatype3.html#datetime)你想使用? –

回答

0

难道你只是把convert的Date实例改为ms,然后在你的数据库中插入long?

所以

cvv.put("time",s.getDate().getTime());