2

Which column type is used for read date in to sqlite database in iphone

kampsj
  • 3,139
  • 5
  • 34
  • 56
Parag Ghetiya
  • 421
  • 2
  • 14

1 Answers1

0

SQLite 3 does not have a DateTime data type. However, you can easily store the date in a TEXT, REAL or Integer.

See http://www.sqlite.org/datatype3.html

kampsj
  • 3,139
  • 5
  • 34
  • 56
  • i have insert date into database... NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init]; [dateFormat setDateFormat:@"yyyy-MM-dd HH:mm:ss"]; NSString *dateString=[dateFormat stringFromDate:[NSDate date]]; sqlite3_bind_text(statement, 4, [dateString UTF8String], -1, SQLITE_TRANSIENT); and read....... 1....char *date_char = (char *) sqlite3_column_text(statement, 3); 2....double date = sqlite3_column_double(statement, 3); Output is... 1....null 2....2012(display only year) – Parag Ghetiya Oct 11 '12 at 12:26
  • 1
    See http://stackoverflow.com/questions/1711504/how-get-a-datetime-column-in-sqlite-with-objective-c – kampsj Oct 11 '12 at 14:16