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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T23:21:07+00:00 2026-06-01T23:21:07+00:00

For an assignment for school I need to be able to calculate certain dates.

  • 0

For an assignment for school I need to be able to “calculate” certain dates.

I have a number of contact moments that I need to auto assign to a certain date (day in the week) and print …

Let’s say from the first of January I need to assign every Monday to a contact moment except if this Monday is a holiday or so. I have a list of valid days in my database in date format to check against.

What I have until now :

For the day I was thinking to start at a certain day and then add 7 day’s

I would set the date :

set(int year, int month, int date) 

And then adding with 7 to go from week to week :

cal.add(Calendar.DAY_OF_MONTH, 7); 

I would then check if this date equals a date in my mysql table.

compareDatesByCalendar(Date javaDate, Date mysqlDate) { 
    Calendar javaCal = Calendar.getInstance();
    Calendar mysqlCal = Calendar.getInstance(); 
    javaCal.setTime(javaDate);
   mysqlCal.setTime(mysqlDate); 
    if (javaCal.equals(mysqlCal)) {
        ……..
    } 
else{
….}

If the day is not in the list I would just add 7 more and check again … .

So on until I have all the moments, adding on them to an array to print

Is this the right way to take this on or a better way?

Let’s say we want to make an appointment each Thursday, is there a way to see what is the first day from the starting point (for example starting from first January).?

What if there is a maximum of weeks (moments available)? How could I block this?

Any suggestions would be more then helpfull! Thx all

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

    Since you will be focusing heavily on dates I would recommend you take a look at the Joda API. It offers more functionality than the standard DateTime Java API. You could take a look here to get started.

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

Sidebar

Related Questions

Hello is have a question for a school assignment i need to : Read
For a school assignment I have to create a C++ program that will create
I currently have a school assignment that involves both PHP and asp.net. Now the
I am working on a school assignment that requires me to be able to
I have an assignment at school to build a webserver that handles GET/HEAD/PUT requests,
I have a school assignment where I need to create a data-driven style of
For an assignment at school, we have to use structs to make matrices that
i have an erd for a school assignment that contains a many to many
I have an assignment for school that is really got the best of me.
We have a school assignment and we were told that all numbers end after

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.