如何更改以下查询以将varchar转换为date&时间类型。 -in我的tabele列是'time'(DATETIME),'Comments'(VARCHAR)
(NSMutableArray *)selectAllFromDB {
time = [NSString stringWithUTF8String:(char *)sqlite3_column_text(selectAllStmt,0)];
} 的 _ _
-in insert method
-(BOOL)insertIntoDB:(NSMutableDictionary *)dict
{
time=[dict objectForKey:@"time"];
if(sqlite3_bind_text(insertStmt, 1, [time UTF8String], -1, SQLITE_TRANSIENT) != SQLITE_OK)
{
return NO;
}
}
如何修改日期数据类型
的这些查询答案 0 :(得分:1)
试试这个: -
- (BOOL)insertIntoDB:(NSMutableDictionary *)dict
{
time=[dict objectForKey:@"time"];
if((sqlite3_bind_double(insert_statement,1,[time timeIntervalSince1970]))!= SQLITE_OK)
{
return NO;
}
}