Insert a time stamp into database via ContentValues

前端 未结 1 2063
遥遥无期
遥遥无期 2021-02-20 04:00

In Android, is it possible to insert a time stamp into a database using ContentValues? When I try to add it using something like this:

ContentValue         


        
相关标签:
1条回答
  • 2021-02-20 04:30

    Neither Date nor Calendar are valid things to put in a ContentValues. The most efficient format, I think, is to convert the Date to milliseconds (getTime()) and store that in an INTEGER column.

    0 讨论(0)
提交回复
热议问题