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 da
Store as a typical C-time (e.g. the time_t/int value returned by time()) value in an UNSIGNED INT column. Convert like drewh said with NSDate:
- timeIntervalSince1970
- dateWithTimeIntervalSince1970:(double)value
Except store as an integer, unless you need sub-second granularity (which, generally, for created-on/last-modified, is overkill). Unsigned ints are a lot smaller and easier to process than doubles. While this may not matter in most desktop and web applications anymore, it certainly helps on the iPhone. Every little bit helps.
One side benefit of C-times that most people don't realize is that they're timezone-agnostic. If you ever need to support multiple timezones, this comes in handy.