Last active
August 29, 2015 14:12
-
-
Save majie1993/8c236df272183ac8e357 to your computer and use it in GitHub Desktop.
Best Performance for Date Transform
From http://vombat.tumblr.com/post/60530544401/date-parsing-performance-on-ios-nsdateformatter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sqlite3_stmt *statement = NULL; | |
sqlite3_prepare_v2(db, "SELECT strftime('%s', ?);", -1, &statement, NULL); | |
sqlite3_bind_text(statement, 1, [dateString UTF8String], -1, SQLITE_STATIC); | |
sqlite3_step(statement); | |
sqlite3_int64 interval = sqlite3_column_int64(statement, 0); | |
NSDate *date = [NSDate dateWithTimeIntervalSince1970:interval]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment