Possible Duplicate:
Sort the date in Sqlite database
I am creating an iPhone application that used SQLite database. In this I have a table that contains three columns and one column is "ReleaseDate" with DATE
datatype. I want to sort the database with respect to the dates in this column. I used the following code.
For inserting,
NSDateFormatter *format = [[NSDateFormatter alloc]init];
[format setDateFormat:@"MM/dd/yyyy"];
NSDate *dateFromString = [[NSDate alloc] init];
dateFromString = [format dateFromString:date];
[format release];
NSTimeInterval timeInterval = [dateFromString timeIntervalSince1970];
sqlite3_bind_double(insertStmt, 4, timeInterval);
here, 'date' is a string value that holds the date value. Now, how can I retrieve data from entire columns from the DB? the query I used is,
select * from ItemTable order by ReleaseDate desc
but sorting is not done.