Objective-C and sqlite's DATETIME type

前端 未结 4 1300
逝去的感伤
逝去的感伤 2020-12-01 06:14

I have a sqlite3 table that I\'m trying to map to an object in objective-C. One attribute of the table is \'completed_at\' which is stored as a DATETIME.

I want to c

4条回答
  •  清歌不尽
    2020-12-01 06:15

    I have zero experience with Objective-C, but I found Apple's NSDate Class Reference with a google search. With the information provided on the linked page you should be able to figure out how to manipulate 32-bit epoch times in Objective-C, and this would work well in SQLite. I would probably create the completed_at column as type INTEGER for 32-bit times.

    SQLite really prefers Julian dates, which are floats. I haven't found any documentation explaining how one might coerce the NSDate class into working with Julians.

    timeIntervalSince1970 looks very interesting.

提交回复
热议问题