Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4237672
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T02:48:16+00:00 2026-05-21T02:48:16+00:00

I have a parameter, where user can choose for which period of time data

  • 0

I have a parameter, where user can choose for which period of time data should be stored.
I read it in days variable. Date and time, when record was added to the database is stored in KEY_DATE_ADDED, it is created like:

SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");  // sql date format
Date date = new Date();
initialValues.put(KEY_DATE_ADDED, dateFormat.format(date));

Then I do the following:

mDb.delete(DATABASE_TABLE, 
           "date(now) > date(" + KEY_DATE_ADDED + ",+" + days + " days)",
           null);

and it doesn’t work. Actual query (where part) looks like:

WHERE date(now) > date(date_added,+10
days)

What is incorrect here? Looks like instead of date_added something else should be here.
I wanted to use SQL data formatting to avoid re-formatting dates several times.

Is there any GUI for Android database to test SQL queries on the actual data?

  • 1 1 Answer
  • 5 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T02:48:16+00:00Added an answer on May 21, 2026 at 2:48 am

    ok, I should use date('now') > date('date_added','+10 days')

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an application in which a user can pass in some or all
Consider a PersonController which has a list action. A user can choose to list
I have methods which parameters can only handle certain types of variable. I have
Well I have a web page asp.net(page1.aspx) amm user can choose two options A/B
I am creating an MSI installer where the user can choose a data directory
How can I have a parameter to one JS function be Function Name with
I am successfully posting to Facebook wall, but I want that user can choose
I have a Java class which can be called from shell. (via java [command][options])
I have a page that has a form on it where the user can
I have UI where a user can search on optional parameters.I am writing a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.