Skip to content

Instantly share code, notes, and snippets.

@majie1993
Last active August 29, 2015 14:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save majie1993/8c236df272183ac8e357 to your computer and use it in GitHub Desktop.
Save majie1993/8c236df272183ac8e357 to your computer and use it in GitHub Desktop.
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