0
我如何使用目標c從sqlite數據庫獲取今天的數據?我使用此查詢,但它返回數據庫中的所有數據:從sqlite使用目標獲取今天的數據c
const char *sql = "select * from SavedD where julianday('now')";
請幫我檢索今天的數據。
我如何使用目標c從sqlite數據庫獲取今天的數據?我使用此查詢,但它返回數據庫中的所有數據:從sqlite使用目標獲取今天的數據c
const char *sql = "select * from SavedD where julianday('now')";
請幫我檢索今天的數據。
嘗試這個
NSDateFormatter* formatter = [[[NSDateFormatter alloc] init] autorelease];
//Set the required date format
[formatter setDateFormat:@"dd-MM-yyyy"];
NSString* cCurrentTimeStamp = [formatter stringFromDate:dDate];
NSString *cPrevTimeStamp=[NSString stringWithFormat:@"%@ 00:00 AM",cCurrentTimeStamp];
NSString *cNextTimeStamp=[NSString stringWithFormat:@"%@ 23:59 PM",cCurrentTimeStamp];
const char *sqlStatement="SELECT * from _tablename where iAgentId=? and dScheduleTIme BETWEEN ? and ?";
,或者如果您正在使用的任何其他格式,然後追加該類型格式化時間上一頁&下一個時間戳
謝謝svrushal,我用這個查詢顯示今天的解決我的問題數據常量char * sql =「select * from SavedD where DateADndTime = date('now')」; – Fad
如何在Table View中獨立顯示每天的數據?我使用這個查詢,但它返回失敗的數據const char * sql =「select * from SavedD where DateADndTime =?」; – Fad
而不是?你可以使用日期('?'),然後以yyyy-MM-dd格式將日期追加到it.ex.date('2012-11-27') – svrushal