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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T07:19:53+00:00 2026-05-26T07:19:53+00:00

I am quite new to Android development, but the person has written the code

  • 0

I am quite new to Android development, but the person has written the code is away and i have taken over this job.

There is one thing I would like to find out quickly…(–

The app is picking up the user input of a date (using a date picker) and i need add a validation to check the if the date is valid. The valid dates are 30 days from today.
After searching on the internet for long time, i’ve found a code i might can use:

  Date today = new Date();
  Date predefined = new SimpleDateFormat("yyyy-MM-dd").parse(today);

  if(today.before(predefined)) {
      ...
  }

But I am not sure how to add 30 days?

If you could tell me, that would be much appreciated.
Thanks in advance.

Edit Here is the Source code I’ve tried.

Calendar today = Calendar.getInstance();
today.add(Calendar.DAY_OF_MONTH,30);
if(calStartDate.compareTo(today)<0) { 
    Toast.makeText(GetClient.this,"It's before valid date!",Toast.LENGTH_SHORT).show();
}else{ 
    Toast.makeText(GetClient.this,"It's a valid date!",Toast.LENGTH_SHORT).show();
}
  • 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-26T07:19:54+00:00Added an answer on May 26, 2026 at 7:19 am

    You want the Calendar class. You can create one and set it to current time/date, and create another and set roll it forward 30 days. Then call compareTo() on one passing in the other.

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

Sidebar

Related Questions

Quite new to coding for android but this issue has me tearing my hair
I'm quite new to android, but I have already created several apps and published,
I'm quite new to Android development (started 2 days ago) and have been through
I'm quite new in Java android development. So I have an issue with my
I am quite new to Android yet, and I have an application that has
Hi I am quite new to php but i have been following some tutorials
I'm pretty new to android development, so I hope my question is easy, but
I'm quite new to Android programming but familiar with C/C++ and Linux enough to
Alright, so I'm new to Android programming, so far my experience has been quite
I am quite new to Android dev, but not Java dev, so doing the

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.