Open top menu

Via this Method  DateTime ,explain how to call to this method



package com.example.androidBeginnerpoint;

public class MainActivity extends Activity {

 
boolean bolvalue = false;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
/*
* check compaired return value in boolean true 
*/
boolean value = checkDateAfter(2015 - 07 - 08, 2015 - 12 - 08);
/*
* check compaired return value in boolean  false
*/
boolean value = checkDateAfter(2015 - 07 - 08, 2015 - 06 - 08);
}

public boolean checkDateAfter(String startDate, String endDate) {
try {
Date endingDate, startingDate;
SimpleDateFormat sdf;
String myFormatString = "yyyy-mm-dd";
sdf = new SimpleDateFormat(myFormatString);
endingDate = sdf.parse(endDate);
startingDate = sdf.parse(startDate);

if ((endingDate.after(startingDate))
|| (endingDate.equals(startingDate)))
bolvalue = true;
else
bolvalue = false;
} catch (Exception e) {

bolvalue = false;
}
return bolvalue;
}

}

Tagged

0 comments