NSDate and Sqlite3 in iPhone
While working with NSDate and sqlite3 on iPhone the common problem many people face is about storing and retrieving NSDate from sqlite3 database. There are mainly two methods to do so, one is to get the time interval (timeIntervalSince1970) from reference date and save the interval as double value in the database, second is to convert date into string using NSDateFormatter and save the text value in the database. NOTE: The type of column where we want to store NSDate should be DATETIME in both the methods. Method 1: using timeIntervalSince1970 Writing NSDate to sqlite3 DB NSDate *dateToWrite = [NSDate…