• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Alternative to NSDate's dateWithNaturalLanguageString: ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Alternative to NSDate's dateWithNaturalLanguageString: ?


  • Subject: Re: Alternative to NSDate's dateWithNaturalLanguageString: ?
  • From: Jason Wiggins <email@hidden>
  • Date: Tue, 1 Jul 2008 01:20:26 +1000

Funnily enough, I've just found and been playing with NSCalendarDate and was unaware of the discouragement of using this class until now, thanks Jens. But it's not deprecated *yet*
From the docs:
Important: Use of NSCalendarDate strongly discouraged. It is not deprecated yet, however it may be in the next major OS release after Mac OS X v10.5. For calendrical calculations, you should use suitable combinations of NSCalendar, NSDate, and NSDateComponents, as described in Calendars in Dates and Times Programming Topics for Cocoa.


JJ

On 01/07/2008, at 1:14 AM, Jens Alfke wrote:


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


_______________________________________________

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


References: 
 >Alternative to NSDate's dateWithNaturalLanguageString: ? (From: "David Arve" <email@hidden>)
 >Re: Alternative to NSDate's dateWithNaturalLanguageString: ? (From: Jens Alfke <email@hidden>)

  • Prev by Date: Re: Alternative to NSDate's dateWithNaturalLanguageString: ?
  • Next by Date: Re: initWithFrame deosn't get called
  • Previous by thread: Re: Alternative to NSDate's dateWithNaturalLanguageString: ?
  • Next by thread: Re: Alternative to NSDate's dateWithNaturalLanguageString: ?
  • Index(es):
    • Date
    • Thread