Unexcepted answering in calulating date & time difference(Wrong result while parsing)
<p>After parsing I am not getting the correct date.. as per input</p>

<pre><code>09-20 12:09:51.859: I/System.out(20544): Inside calculate diff
09-20 12:09:51.859: I/System.out(20544): ARRIVAL IS11-9-1989 11:45
09-20 12:09:51.859: I/System.out(20544): DEPARTURE IS26-3-1990 12:3
09-20 12:09:51.859: I/System.out(20544): ARRIVAL IN TRY ISTue Feb 09 12:08:20 GMT+05:30 17
09-20 12:09:51.859: I/System.out(20544): DEPARTURE IN TRY ISSat Aug 11 12:26:20 GMT+05:30 31
09-20 12:09:51.859: I/System.out(20544): Time Difference is457575480000
09-20 12:09:51.859: I/System.out(20544): NUmber of days is10592.0
</code></pre>

<p>Class File where I am implementing the code.</p>

<pre><code>public class Add extends Activity implements OnClickListener
{
    private TimePicker arrivalTime,departureTime;
    private DatePicker arrivalDate,departureDate;
    private Button addButton;


    @Override
    protected void onCreate(Bundle outState) {
        // TODO Auto-generated method stub
        super.onCreate(outState);
        setContentView(R.layout.add);

        arrivalTime=(TimePicker)findViewById(R.id.timePicker1);
        arrivalTime.setIs24HourView(true);

        departureTime=(TimePicker)findViewById(R.id.timePicker2);
        departureTime.setIs24HourView(true);

        arrivalDate=(DatePicker)findViewById(R.id.datePicker1);

        departureDate=(DatePicker)findViewById(R.id.datePicker2);

        addButton=(Button)findViewById(R.id.buttonAdd);
        addButton.setOnClickListener(this);



    }
    public void onClick(View v) {
        if (v==addButton)
        {
            String arrDate= arrivalDate.getDayOfMonth()+"-"+getMonthString(+arrivalDate.getMonth())+"  - "+arrivalDate.getYear();
            int iTmp=+arrivalDate.getMonth();
            iTmp=iTmp+1;
            String arrDate1= arrivalDate.getDayOfMonth()+"-"+iTmp+"-"+arrivalDate.getYear();
            String arrTime=arrivalTime.getCurrentHour().toString()+":" + arrivalTime.getCurrentMinute().toString();
            System.out.println("Arrival Date is"+arrDate);
            System.out.println("  Time is "+arrTime);

            String deptDate= departureDate.getDayOfMonth()+"-"+getMonthString(+departureDate.getMonth())+"  - "+departureDate.getYear();
            int jTmp=+departureDate.getMonth();
            jTmp=jTmp+1;
            String deptDate1= departureDate.getDayOfMonth()+"-"+jTmp+"-"+departureDate.getYear();
            String deptTime=departureTime.getCurrentHour().toString()+":" + departureTime.getCurrentMinute().toString();

            System.out.println("Dept Date is"+deptDate);
            System.out.println("Time is "+deptTime);


            CalculateDifference(arrDate1,arrTime,deptDate1,deptTime);

        }


    }
    private void CalculateDifference(String arrDate, String arrTime,String deptDate, String deptTime)
    {
        String arrival=arrDate+" "+arrTime;
        String dept=deptDate+" "+deptTime;
        System.out.println("Inside calculate diff");
        System.out.println("ARRIVAL IS"+arrival);
        System.out.println("DEPARTURE IS"+dept);
        SimpleDateFormat format = new SimpleDateFormat("E MMM yy HH:mm");
        Date date1 = null;
        Date date2 = null;
        long difference = 0;
        try {
            date1 = format.parse(arrival);
            date2 = format.parse(dept);
            System.out.println("ARRIVAL IN TRY IS"+date1);
            System.out.println("DEPARTURE IN TRY IS"+date2);
            difference = date2.getTime() - date1.getTime(); 
            System.out.println("Time Difference is"+difference);
        } catch (ParseException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

        //the # of days
        float days = (difference/1000/60/60/12);
        System.out.println("NUmber of days is"+days);

    }
    public String getMonthString(int i)
    {
        String month="";
        if(i==0)
        {
            month="Jan";
        }
        else if(i==1)
        {
            month="Feb";
        }
        else if(i==2)
        {
            month="March";
        }
        else if(i==3)
        {
            month="April";
        }
        else if(i==4)
        {
            month="May";
        }
        else if(i==5)
        {
            month="Jun";
        }
        else if(i==6)
        {
            month="July";
        }
        else if(i==7)
        {
            month="Aug";
        }
        else if(i==8)
        {
            month="Sept";
        }
        else if(i==9)
        {
            month="Oct";
        }
        else if(i==10)
        {
            month="Nov";
        }
        else if(i==11)
        {
            month="Dec";
        }
        return month;

    }


}
</code></pre>

<p>Friends,my method is wrong output. Please correct me.<strong>The input is coming from datepicker and timepicker widget of android</strong></p>
