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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T23:58:52+00:00 2026-06-10T23:58:52+00:00

I have two EditText’s. One with start date and other with end date. I

  • 0

I have two EditText’s. One with start date and other with end date.
I need to make a validation and check if end date is greater than start-date. I don’t know how i can do this.

In my code i make the difference bettween two dates in days, and now i also need to check if end date is greater than start-date

Here is my code:

             //EditText with string of start date
            dataInicio = (EditText)findViewById(R.id.ses_dpDataIni);
             //EditText with string of end date
    dataFim = (EditText)findViewById(R.id.ses_dpDataFim);

             //Convert String to calendar to check the difference between two dates..
    try{
    dateInic = dataInicio.getText().toString();
    dateFim = dataFim.getText().toString();

    calInic=Calendar.getInstance();
    calFim = Calendar.getInstance();
    calInic.setTime(form.parse(dateInic));
    calFim.setTime(form.parse(dateFim));
    }
     catch (ParseException e) { 
         e.printStackTrace(); 
    } 
    Log.w(SessaoQuotaEdit.class.getName(),"DIFERENCA DE DIAS"  +daysBetween(calInic,calFim));
    tvDiasQuotas = (TextView)findViewById(R.id.ses_tvNumDiasQuota);
    tvDiasQuotas.setText("NUMBER OF DAYS: " +daysBetween(calInic,calFim));

            //CHECK IS END-DATE IS GREATER THAN START-DATE
             .............
             .............

Can you help me?
Thanks 🙂

  • 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-10T23:58:53+00:00Added an answer on June 10, 2026 at 11:58 pm
    SimpleDateFormat dfDate  = new SimpleDateFormat("yyyy-MM-dd");
    public static boolean checkDates("2012-07-12", "2012-06-12)"    {
        boolean b = false;
        try {
            if(dfDate.parse(d1).before(dfDate.parse(d2)))
            {
                b = true;//If start date is before end date
            }
            else if(dfDate.parse(d1).equals(dfDate.parse(d2)))
            {
                b = true;//If two dates are equal
            }
            else
            {
                b = false; //If start date is after the end date
            }
        } catch (ParseException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return b;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to override styles for two EditText instances. I have two issues regarding
I have two EditTexts in XML. In one EditText, the user can put a
i am self_learner to android. I have two screens.The first screen contains one edittext
I have a custom dialog with one editText view and two buttons ok and
I have two EditText and one Button in my Layout. If the two EditText
I have two LinearLayout One contains a EditText with a patch9 image as a
I have two EditText controls in one TableLayout>TableRow. I have another TableLayout>TableRow that has
In My Application there is two EditText and one TextView. I have set the
I have an activity that has two EditText boxes, one email and one plain
I have been building an application. One of the activity involves two EditText fields.

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.