Re: Alternative to NSDate's dateWithNaturalLanguageString: ?
Re: Alternative to NSDate's dateWithNaturalLanguageString: ?
- Subject: Re: Alternative to NSDate's dateWithNaturalLanguageString: ?
- From: Jens Alfke <email@hidden>
- Date: Mon, 30 Jun 2008 08:14:08 -0700
On 30 Jun '08, at 12:29 AM, David Arve wrote:
sqlite3_bind_int(sql_statement, 1, one_week);
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.)
—Jens_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden