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

  • Home
  • SEARCH
  • 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 8700975
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T02:17:26+00:00 2026-06-13T02:17:26+00:00

while (rs.next()) { String rn = rs.getString(3); String sqldate = rs.getString(2); // database reservation

  • 0
while (rs.next()) {
    String rn = rs.getString(3);
    String sqldate = rs.getString(2); // database reservation date
    if (rn.equals(rnumber)) {
        Calendar cal = Calendar.getInstance();
        String rdate = (Integer.toString(cal.get(Calendar.YEAR)) + "-" + Integer.toString(cal.get(Calendar.MONTH)) + "-" + Integer.toString(cal.get(Calendar.DATE)));
    } else {
        response.sendRedirect("status.jsp?Status=Reservation number not exist");
    }
}

I need to add 7 days to SQL date ( 2012-10-05 +7 ) and need to check those days are in between SQL date and current date.

  • 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-13T02:17:27+00:00Added an answer on June 13, 2026 at 2:17 am

    You need to parse your date string to create a java.sql.Date object: –

    String sqldate = rs.getString(2);
    DateFormat DOB = new SimpleDateFormat("yyyy-MM-dd");
    java.sql.Date convertedDate = new java.sql.Date(DOB.parse(sqldate).getTime());
    

    Then use Calendar.setTime() method to set Date to Calendar instance: –

    Calendar cal = Calendar.getInstance();
    cal.setTime(convertedDate);
    cal.add(Calendar.DATE, 7);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

while (r.next()) { String rn = r.getString(3); String sqldate = r.getString(2); // database reservation
i need to store a DatSet value into ArrayList while(result.next()) { String Adress= result.getString(1);
i have the next code: std::string line; std::ifstream myfile (text.txt); if (myfile.is_open()) { while
myRs=myStmt.executeQuery(select i_col,col_name from tab_col) i=0 while (myRs.next()): list= myRs.getString(I_COL)+','+myRs.getString(COL_NAME) i have a jython code
$(.sectionHeader).click(function() { var row = $(this).parent(); while (row.next().length != 0) { row = row.next();
Statement stmt=conn.createStatement(); //1 Statement stmt2=conn.createStatement(); //2 ResultSet resultSet1=stmt.executeQuery(-----); //3 while(resultSet1.next()) { //4 ResultSet resultSet2
Im trying to make a basic while loop example im preperation for my next
it should set the current character to next character. For example: while( *foo )
So, while I was working on some code for my next app update, I
I'm trying to select data from database using this code: //DATABASE ResultSet rs; String

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.