Shouldn't that be sqlite3_bind_double? The variable one_week is
declared as double, and I'm pretty sure that seconds-since-1970
intervals are soon going to overflow a (signed) 32-bit int, if they
haven't already.
Is there a better way for me to get e.g. the dates from my database
from
this week, this month etc.?
Look at "Calendars" in the "Date & Time Programming Guide For Cocoa",
which describes how to do manipulations with calendar dates. In a
nutshell, you can find the beginning of the week by getting the
current date/time, then breaking it into components and setting the
day-of-week plus hour/minute/second to zero, then converting back to
NSDate. Then you can call -timeIntervalSince1970.
(I'd give you an example, but my own code that does this uses the
deprecated NSCalendarDate class. I haven't used NSCalendar myself, yet.)