开发者

timestamp problem in android sqlite3

I want insert the current date and time into my table.... I used this query

insert into tbl_reminder values("Description",current_timestamp);

but it insert the wrong time... actually the timestamp in my emulator is 2010-09-16 18:40:06 but the inserted timestamp value is 2010-09-16 13:10开发者_如何学Go:06 what i do to insert the exact time...


Insert it enclosed within Quotes, the date will be stored as a string.

sqlite doesn't has a Date datatype.

Now, the following is just incase you are planning to use the Date column for Comparisions...

Speaking from experience, i would advice you store it as Long Integer, as a Unix Timestamp, it lets you do Comparison between dates, which would otherwise be very difficult.

You'll obviously have to convert it to-and-fro but in the long run it's a better stratergy.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜