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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T12:49:00+00:00 2026-06-09T12:49:00+00:00

Im using SQLite as data storage for my Android App. I have created one

  • 0

Im using SQLite as data storage for my Android App. I have created one table with column of type datetime. When I do the insert of records or selects statements I use the format dd.MM.yyyy (10.08.2012) for dates.

Now, I have issue with getting the row with the latest / MAX date. I have tried using the MAX(date_column) statement, but it returns wrong date back. I have following dates in my table and it returns 31.07.2012 in stead of 04.08.2012. Anyone know what I’m doing wrong?

04.08.2012
03.08.2012
02.08.2012
01.08.2012
31.07.2012
30.07.2012

Here is part of the code:

String selection = "measurementDate = (SELECT MAX(measurementDate) FROM Measurements)";
Cursor cursor = database.query("Measurements", allColumns, selection, null, null, null, null);
cursor.moveToFirst();
...
  • 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-09T12:49:01+00:00Added an answer on June 9, 2026 at 12:49 pm

    It’s probably due to the comparison being made on the stored string rather than treating it as a date.

    You could store the string in differently, YYYYMMDD, which should compare them correctly or, if you can modify the table, store the dates as milliseconds and format back to a string when needed.

    This might help

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

Sidebar

Related Questions

I have created one app in iOS5. I want to store and retrive data
I am using sqlite in my app, i want to edit some data in
I am using an sqlite database to store log data. My table has a
I have a WPF Application using Fluent NHibernate 1.0 RTM and System.Data.SQLite 1.0.65 that
I'm trying to insert data into the SQLite database using get EditText, but I
In my app i am using Sqlite data base to store the data. The
How to insert data into table in sqlite iPhone? I am trying following, but
I'm using sqlite as temporary storage to calculate statistic about moderately large data set.
I am using System.Data.Sqlite to access SQLite database in C#. I have a query
I have a SQLite Database that I access using System.Data.SQLite . The database is

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.