I am developing an iPhone application that persists data to a SQLite3 database.
For each row I persist I wish to include a 'created date' and a 'last modified date'
My question is what is the recommend approach for storing this information in a table?
The properties are represented as NSDate in my application but I am unsure how to represent this information in my table.
It appears that SQLite3 provides a DATETIME type but does not have a native understanding of how to parse this information.
Any help would be much appreciated.
Thanks in advance.
I typically use a double, something like:
sqlite3_bind_double(statement, index, [dateObject timeIntervalSince1970]);
where dateObject is an NSDate*. Then, when getting the data out of the DB, use
[NSDate dateWithTimeIntervalSince1970:doubleValueFromDatabase];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With