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 8369409
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T13:38:13+00:00 2026-06-09T13:38:13+00:00

I store a date in my database format MM/dd/yyyy and I want to do

  • 0

I store a date in my database format “MM/dd/yyyy” and I want to do a query by a specific date but when I make the query the cursor returns nothing.

Is it because of the “/” that is in the string or something else? And yes I know the date is stored properly in the database

@Override
public Loader<Cursor> onCreateLoader(int arg0, Bundle arg1) {
        return new CursorLoader(getActivity(),Games.GAMES_URI,new String[] {Games.GAMES_ID},Games.GAMES_DATE + "="+dt,
                null,null);
}

converting the date

public convertDate(Calendar date){
        mDate = date;           
        Date d = new Date(date.getTimeInMillis());
        DateFormat df = new SimpleDateFormat("MM/dd/yyyy");
        dt = df.format(d);
}
  • 1 1 Answer
  • 0 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-06-09T13:38:15+00:00Added an answer on June 9, 2026 at 1:38 pm

    The query you are trying to do will look like:

    ... WHERE games_date=08/11/2012
    

    where it needs to be:

    ... WHERE games_date="08/11/2012"
    

    (assuming that games_date is the name of the column — replace as needed)

    Try Games.GAMES_DATE + "=?" for your fourth CursorLoader constructor parameter, and {dt} for your fifth CursorLoader constructor parameter, and Android/SQLite will automatically add your quotation marks for you where needed, assuming that your ContentProvider is backed by SQLite.

    Also, you might consider storing your date in some other format. If you want it to be a string, yyyy-MM-dd (or yyyy/MM/dd) is a better choice, as it will sort correctly in chronological order. If you do not need it to be a string, just storing getTimeInMillis() in an INTEGER column will make it easier to convert to and from Date objects without messing with string conversions.

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

Sidebar

Related Questions

i want to compare database field of date that has YYYY-MM-DD format and i
I have date in dd/mm/yyyy format. How can I store it in a database,
I am getting date in forms in dd/MM/yyyy format but in database it is
My MySQL database has date of birth stored in the format yyyy-mm-dd, how do
I have a database field where date is stored as DD/MM/YYYY format. Now what
in my database i stored date in the format yyyy-mm-dd i need to compare
I have a date format that I am getting from the database and is
I have date of Birth of the format 04/08/2010(DD/MM/YYYY) and sql server store of
MySQL stores the date in my database (by default) as 'YYYY-MM-DD' The field type
I am using Microsoft Access database for storing data. In that, I stored date

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.