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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T23:09:22+00:00 2026-06-08T23:09:22+00:00

In my simple application, I am storing the timestamp into the database table programmatically

  • 0

In my simple application, I am storing the timestamp into the database table programmatically by using new Timestamp(System.currentTimeMillis()).

Now, I have one condition, where I have to store the onClick count for a particular day, and all onClick counts into two different columns.

So for that, I need to find out onClicks for today. So how can I find out if the time onclicks occur are today? I mean for say 1st August, I want all the onclick counts in one column and all previous onClick counts into another column.

*In simple words – storing clicks for today in one column and storing clicks till now in another column, so if today expires, I want to add clicks for today with total clicks and then make the today_clicks column count to 0 and then when there is new click on next day, store it in the today_clicks column by starting it with count 1*

How can I decide that? Which Java class should I use for that?

  • 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-08T23:09:24+00:00Added an answer on June 8, 2026 at 11:09 pm

    If I understand correctly, you are looking for a way to best store your data in your database. You have decided to maintain a clicks-for-today column and a clicks-until-now column. (I may be off base on this, but it wasnt completely clear from the question)

    I would suggest that you dont try to manipulate the data from column to column as you have described, but instead do so by maintaining click counts per day:

     date | count
    ------|-------
    Jul 31| 10876
    Aug  1| 15721
    

    (where date is a in the db timestamp/date datatype)

    How would this work?

    At startup, you could then bring into memory all rows, and sum their counts to get a clicks-until-now value, if needed.

    You then have special handling for today’s row, where you update the appropriate context with the clicks-for-today value.

    To determine whether you’ve passed a day threshold, you could simply:

    1. maintain a Calendar instance for ‘today’ (call it todayCal)
    2. generate a new Calendar each time you record a click (call it clickCal)
    3. test Calendar.DAY_OF_YEAR from todayCal and clickCal
    4. if you identify a day roll, you persist the clicks-for-today in the db and initialized a new clicks-for-today.
    5. if you are maintaining total click count in memory, you can do the math at this point.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table in a database which is used for storing application configuration
I'm working on a simple facebook application where I'm storing: Facebook friends ID Table
I have developed a simple application using SDK(Android: 3.2[API-13]) for, to display Google banners.
I started using a SQLite database in my android application. Very simple to use
I am new in iphone development, and I have made a simple application for
I have a table that stores the page hits on a web application, storing
I have an application built with codeigniter using the sessions class and storing session
I'm trying to test a simple SQLite database using Robolectric in my Android application.
Lets write simple console application: static void Main(string[] args) { IList<Thread> threads = new
I have a very simple StopWatch application in Silverlight. I have the following private

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.