Coder05
- Forum posts: 1
Mar 18, 2014, 12:52:22 AM via Website
Mar 18, 2014 12:52:22 AM via Website
Hi,
I have inserted date in sqlitedatabase and want to get results according to date for the last 7 days.
I have inserted date in sqlitedatabase and want to get results according to date for the last 7 days.
1String[] columns = new String[]{KEY_ROWID, KEY_NAME};
2 String result =" ";
3
4 long sevenDays = System.currentTimeMillis() - 1000 * 60 * 60 * 24 * 7L;
5 Cursor c = ourDatabase.query(DATABASE_TABLE, null, KEY_DATE + " > "+ sevenDays, null, null, null, null);
6
7 int iRow = c.getColumnIndex(KEY_ROWID);
8 int iName = c.getColumnIndex(KEY_NAME);
9
10
11// How can I get all the names entered in the last 7 days. Thanks
2 String result =" ";
3
4 long sevenDays = System.currentTimeMillis() - 1000 * 60 * 60 * 24 * 7L;
5 Cursor c = ourDatabase.query(DATABASE_TABLE, null, KEY_DATE + " > "+ sevenDays, null, null, null, null);
6
7 int iRow = c.getColumnIndex(KEY_ROWID);
8 int iName = c.getColumnIndex(KEY_NAME);
9
10
11// How can I get all the names entered in the last 7 days. Thanks
Recommended editorial content
With your consent, external content is loaded here.
By clicking on the button above, you agree that external content may be displayed to you. Personal data may be transmitted to third-party providers in the process. You can find more information about this in our Privacy Policy.