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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T05:01:09+00:00 2026-06-17T05:01:09+00:00

I am working on an android app at school. I am currently building a

  • 0

I am working on an android app at school. I am currently building a notepad. I would like to know if there are any ways to get the date and store it into the sqlite database as a date format and then, when I am retrieving it from the database and write it into my textview, I could display hh::mm if the note was written/modified today, or dd/mm/yy if it were (let’s say) written yesterday. To be more clear:

  1. I write a note
  2. I get the date
  3. I insert everything into my database table
  4. Retrieve the data into a ListView
  5. for each note, I want to display the date in the right format,( if the date was the same day, just display the hh:mm, yesterday if it was written yesterday, else display dd/mm/yy

Also, which way is better to store the date into database, as Date format? I searched online and it appears that there are several ways to do it, which one is the best?

  • 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-17T05:01:10+00:00Added an answer on June 17, 2026 at 5:01 am

    Date can be converted to long value (number of milliseconds passed from Jan, 1 1970 00:00:00 UTC+0000).

    It surely is the most convenient presentation of date:

    1. System.currentTimeMillis() returns current date in this format;
    2. This format is used to set an alarm using AlarmManager;
    3. Easy to determine which date is earlier (just compare two long values – less is earlier);
    4. Easy to store in the database or using SharedPreferences.

    Calendar class which is standard for date operations in Java, also supports this format – it has setTimeInMillis() and getTimeInMillis() functions.

    For more details, refer to the documentation on Calendar class.

    As for different date formats, check out the SimpleDateFormat class.

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

Sidebar

Related Questions

Working on an Android app with FB 4.6, I would like to have the
I'm working on an Android app in which I would like to use multi-touch.
I am working on an Android app, for which I would like the user
Working on an Android app where I would like to display the number of
I am working on an android app and would like to add a facebook
I'm working on android app development in which how get profiling information like Data
I am working on an android app, and I am currently trying to create
I working on an android app which can benefit from device information. Like make,
I'm working on an android app which would connect to a web server which
I am currently working on an Android app and I am trying to connect

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.