Question

I have been storing date records (Date().getTime()) in an SQLite database with an Integer type. I realize now that Date().getTime() is returning Long values, not Integer.

Is there any way I can rescue the date data that is already stored in the database? Going forward I can reduce the resolution of the time, to make it fit into an integer. (ie. divide by 1000, and cast to int)

I expect that forcing a long value into an integer space has truncated the most significant digits - which might work in my favour, as the dates in question have all occurred within the past 6 months, so can probably be calculated.

question so, how exactly would the long representation of today's date map onto an integer, and how might I use that knowledge (combined with the restricted time range) to build these integers back into their original long values?

Any suggestions?

Était-ce utile?

La solution

Turns out the SQLite database integer type is perfectly capable of storing long values. So the data rescue was unnecessary in the end.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top