Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Alternative to NSDate's dateWithNaturalLanguageString: ?



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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.