How get a datetime column in SQLite with Objective C

前端 未结 5 1139
野趣味
野趣味 2020-11-28 11:29

How do you get a datetime column in SQLite with Objective C?

I have a table with 4 fields: pk, datetime, value1 and valu

5条回答
  •  刺人心
    刺人心 (楼主)
    2020-11-28 12:11

    If you can define the database, then ou could also use REAL (SQLite data type) as the type for the datetime, then load it with sqlite3_column_double(). This will return a variable of the type double.

    Then you can use [NSDate dateWithTimeIntervalSince1970:double_value] to get an NSDate object.

提交回复
热议问题