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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T19:29:06+00:00 2026-05-23T19:29:06+00:00

I need to update some user records in my database every month (specifically, give

  • 0

I need to update some user records in my database every month (specifically, give them credits that belong to their subscription), starting the day they sign up. I thought of doing it this way:

Once every day…

  • Find all users that have been updated a month ago (or more, in case the process fails for a
    day)
  • Update them
  • Increase their last update day by a month

Sounds simple, but simpler than it is. The problem is that months don’t always have the same number of days. For example, if somebody signs up march 31, when should he be updated? April 30, may 1? Or should I simply restrict the range of update days to the lowest common range, 28? I could of course just do it on the 1st, for everyone, though that’s less ideal.

Do you have experiences to share with situations like this? I’m using MySQL 5 from Java+JPA+Hibernate. If it helps, I’m already using JodaTime for something else.

  • 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-05-23T19:29:07+00:00Added an answer on May 23, 2026 at 7:29 pm

    Get the maximum day of the month by following code.

        Calendar calendar = Calendar.getInstance();     
        java.sql.Date userSignupdate = ...;
        calendar.setTimeInMillis( userSignupdate );
    
        // maxDay will hold the maximum date of the month. {28,29,30,31}
        int maxDay = calendar.getActualMaximum(Calendar.DAY_OF_MONTH);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need some SQL to update a record in a database if it exists
I need to use scp update some directory at another server. It is similar
I need to execute a select and then update some of the rows in
I have a case where I need to update a jqgrid based on some
I need to update a record in a database with the following fields [ID]
I need some help in thinking through the process to do batch update on
Background I have an SQL CE database, that is constantly updated (every second). I
I have developed an application that pulls X amount of records from my database
I need to update a combobox with a new value so it changes the
I need to update a group of cells by inserting the same two characters

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.