0 的SQLite 3不具有DateTime數據類型。但是,您可以輕鬆地將日期存儲在TEXT,REAL或Integer中。 參見http://www.sqlite.org/datatype3.html 來源 2012-09-10 13:23:21 kampsj +0 我有插入日期到數據庫... 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); 輸出是... 1 ....空 2 .... 2012(僅顯示年) – +1 見http://stackoverflow.com/questions/1711504/how-get-a-datetime-column -in-sqlite-with-objective-c – kampsj +1 它在Xcode 3.1中工作? –
我有插入日期到數據庫... 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); 輸出是... 1 ....空 2 .... 2012(僅顯示年) –
見http://stackoverflow.com/questions/1711504/how-get-a-datetime-column -in-sqlite-with-objective-c – kampsj
它在Xcode 3.1中工作? –