• 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
Alternative to NSDate's dateWithNaturalLanguageString: ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Alternative to NSDate's dateWithNaturalLanguageString: ?


  • Subject: Alternative to NSDate's dateWithNaturalLanguageString: ?
  • From: "David Arve" <email@hidden>
  • Date: Mon, 30 Jun 2008 09:29:38 +0200

Hi,
I have a sqlite3 database storing some time information as the time interval
since 1970 as a REAL type. To get the total time interval since for example
the beginning of this week I use something like the following.

const char *sql = "SELECT SUM(end - begin) FROM table WHERE begin>?";

sqlite3_prepare_v2(database, sql, -1, &sql_statement, NULL);

double one_week = [[NSDate dateWithNaturalLanguageString:@"last monday 00:00
"] timeIntervalSince1970];

sqlite3_bind_int(sql_statement, 1, one_week);


Though the method dateWithNaturalLanguageString is described as "It may give
unexpected results, and its use is strongly discouraged.".

Is there a better way for me to get e.g. the dates from my database from
this week, this month etc.?

Thank you very much,

David
_______________________________________________

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

  • Follow-Ups:
    • Re: Alternative to NSDate's dateWithNaturalLanguageString: ?
      • From: Jens Alfke <email@hidden>
  • Prev by Date: Re: viewing method calls
  • Next by Date: Process app.
  • Previous by thread: Re: Layer Backed Views and CoreAnimation neither animate nor stay in place
  • Next by thread: Re: Alternative to NSDate's dateWithNaturalLanguageString: ?
  • Index(es):
    • Date
    • Thread