本文整理匯總了Java中java.util.Calendar.compareTo方法的典型用法代碼示例。如果您正苦於以下問題:Java Calendar.compareTo方法的具體用法?Java Calendar.compareTo怎麽用?Java Calendar.compareTo使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類java.util.Calendar
的用法示例。
在下文中一共展示了Calendar.compareTo方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setDate
import java.util.Calendar; //導入方法依賴的package包/類
private void setDate(Calendar date)
{
setTitleDate(date.getTime());
int year = date.get(Calendar.YEAR);
int month = date.get(Calendar.MONTH);
int day = date.get(Calendar.DATE);
Calendar calendar = GregorianCalendar.getInstance();
Calendar today = new GregorianCalendar(calendar.get(Calendar.YEAR),
calendar.get(Calendar.MONTH),
calendar.get(Calendar.DATE));
prevEntry = getPrevEntry(year, month, day);
if ((prevEntry == null || today.compareTo(prevEntry) > 0) &&
today.compareTo(date) < 0)
prevEntry = today;
currEntry = date;
nextEntry = getNextEntry(year, month, day);
if ((nextEntry == null || today.compareTo(nextEntry) < 0) &&
today.compareTo(date) > 0)
nextEntry = today;
invalidateOptionsMenu();
}
示例2: countDutyday
import java.util.Calendar; //導入方法依賴的package包/類
/**
* 計算兩個Date之間的工作日時間差
*
* @param start 開始時間
* @param end 結束時間
* @return int 返回兩天之間的工作日時間
*/
public static int countDutyday(Date start, Date end) {
if (start == null || end == null) return 0;
if (start.after(end)) return 0;
Calendar c_start = Calendar.getInstance();
Calendar c_end = Calendar.getInstance();
c_start.setTime(start);
c_end.setTime(end);
//時分秒毫秒清零
c_start.set(Calendar.HOUR_OF_DAY, 0);
c_start.set(Calendar.MINUTE, 0);
c_start.set(Calendar.SECOND, 0);
c_start.set(Calendar.MILLISECOND, 0);
c_end.set(Calendar.HOUR_OF_DAY, 0);
c_end.set(Calendar.MINUTE, 0);
c_end.set(Calendar.SECOND, 0);
c_end.set(Calendar.MILLISECOND, 0);
//初始化第二個日期,這裏的天數可以隨便的設置
int dutyDay = 0;
while (c_start.compareTo(c_end) < 0) {
if (c_start.get(Calendar.DAY_OF_WEEK) != 1 && c_start.get(Calendar.DAY_OF_WEEK) != 7)
dutyDay++;
c_start.add(Calendar.DAY_OF_YEAR, 1);
}
return dutyDay;
}
示例3: start
import java.util.Calendar; //導入方法依賴的package包/類
public static void start(Context ctx) {
AlarmManager manager = (AlarmManager) ctx.getSystemService("alarm");
PendingIntent pending = PendingIntent.getBroadcast(ctx, 152, new Intent(ctx,
SportRemindReceiver.class), 134217728);
Helper.showLog(TAG, "SportRemindReceiver start");
Calendar calNow = Calendar.getInstance();
Calendar calSet = (Calendar) calNow.clone();
calSet.setTimeInMillis(System.currentTimeMillis());
int remindHour = 20;
int remindMinute = 30;
if (!TextUtil.isEmpty(OnePreference.getPrefSportRemindTime())) {
String[] times = OnePreference.getPrefSportRemindTime().split("#");
if (times.length == 2) {
remindHour = Integer.parseInt(times[0]);
remindMinute = Integer.parseInt(times[1]);
}
}
calSet.set(11, remindHour);
calSet.set(12, remindMinute);
calSet.set(13, 0);
calSet.set(14, 0);
if (calSet.compareTo(calNow) <= 0) {
calSet.add(5, 1);
}
manager.setRepeating(0, calSet.getTimeInMillis(), a.h, pending);
}
示例4: compareDateOfSecond
import java.util.Calendar; //導入方法依賴的package包/類
/**
* 比較兩個日期大小(比較年月日時分秒),com1大於com2返回1,反之返回-1,相等則返回0
*
* @param date1
* @param date2
* @return
*/
public static int compareDateOfSecond(Date date1, Date date2) {
Calendar c1 = Calendar.getInstance();
c1.setTime(date1);
c1.set(Calendar.MILLISECOND, 0);
Calendar c2 = Calendar.getInstance();
c2.setTime(date2);
c2.set(Calendar.MILLISECOND, 0);
return c1.compareTo(c2);
}
示例5: getYearBy
import java.util.Calendar; //導入方法依賴的package包/類
/**
* 獲取年份時間段內的所有年
*
* @param StartDate
* @param endDate
* @return
*/
public static List<String> getYearBy(String StartDate, String endDate) {
DateFormat df = new SimpleDateFormat("yyyy");
Date date1 = null; // 開始日期
Date date2 = null; // 結束日期
try {
date1 = df.parse(StartDate);
date2 = df.parse(endDate);
} catch (ParseException e) {
e.printStackTrace();
}
Calendar c1 = Calendar.getInstance();
Calendar c2 = Calendar.getInstance();
// 定義集合存放月份
List<String> list = new ArrayList<String>();
// 添加第一個月,即開始時間
list.add(df.format(date1));
c1.setTime(date1);
c2.setTime(date2);
while (c1.compareTo(c2) < 0) {
c1.add(Calendar.YEAR, 1);// 開始日期加一個月直到等於結束日期為止
Date ss = c1.getTime();
String str = df.format(ss);
list.add(str);
}
return list;
}
示例6: compareDate
import java.util.Calendar; //導入方法依賴的package包/類
/**
* 根據單位字段比較兩個日期
*
* @param date
* 日期1
* @param otherDate
* 日期2
* @param withUnit
* 單位字段,從Calendar field取值
* @return 等於返回0值, 大於返回大於0的值 小於返回小於0的值
*/
public static int compareDate(Date date, Date otherDate, int withUnit) {
Calendar dateCal = Calendar.getInstance();
dateCal.setTime(date);
Calendar otherDateCal = Calendar.getInstance();
otherDateCal.setTime(otherDate);
switch (withUnit) {
case Calendar.YEAR:
dateCal.clear(Calendar.MONTH);
otherDateCal.clear(Calendar.MONTH);
case Calendar.MONTH:
dateCal.set(Calendar.DATE, 1);
otherDateCal.set(Calendar.DATE, 1);
case Calendar.DATE:
dateCal.set(Calendar.HOUR_OF_DAY, 0);
otherDateCal.set(Calendar.HOUR_OF_DAY, 0);
case Calendar.HOUR:
dateCal.clear(Calendar.MINUTE);
otherDateCal.clear(Calendar.MINUTE);
case Calendar.MINUTE:
dateCal.clear(Calendar.SECOND);
otherDateCal.clear(Calendar.SECOND);
case Calendar.SECOND:
dateCal.clear(Calendar.MILLISECOND);
otherDateCal.clear(Calendar.MILLISECOND);
case Calendar.MILLISECOND:
break;
default:
throw new IllegalArgumentException("withUnit 單位字段 " + withUnit + " 不合法!!");
}
return dateCal.compareTo(otherDateCal);
}
示例7: compareTime
import java.util.Calendar; //導入方法依賴的package包/類
/**
* 根據單位字段比較兩個時間
*
* @param date
* 時間1
* @param otherDate
* 時間2
* @param withUnit
* 單位字段,從Calendar field取值
* @return 等於返回0值, 大於返回大於0的值 小於返回小於0的值
*/
public static int compareTime(Date date, Date otherDate, int withUnit) {
Calendar dateCal = Calendar.getInstance();
dateCal.setTime(date);
Calendar otherDateCal = Calendar.getInstance();
otherDateCal.setTime(otherDate);
dateCal.clear(Calendar.YEAR);
dateCal.clear(Calendar.MONTH);
dateCal.set(Calendar.DATE, 1);
otherDateCal.clear(Calendar.YEAR);
otherDateCal.clear(Calendar.MONTH);
otherDateCal.set(Calendar.DATE, 1);
switch (withUnit) {
case Calendar.HOUR:
dateCal.clear(Calendar.MINUTE);
otherDateCal.clear(Calendar.MINUTE);
case Calendar.MINUTE:
dateCal.clear(Calendar.SECOND);
otherDateCal.clear(Calendar.SECOND);
case Calendar.SECOND:
dateCal.clear(Calendar.MILLISECOND);
otherDateCal.clear(Calendar.MILLISECOND);
case Calendar.MILLISECOND:
break;
default:
throw new IllegalArgumentException("withUnit 單位字段 " + withUnit + " 不合法!!");
}
return dateCal.compareTo(otherDateCal);
}
示例8: applyOutages
import java.util.Calendar; //導入方法依賴的package包/類
private static AppliedOutages applyOutages(Calendar outageDate, int model, boolean logDetail) {
AppliedOutages result = new AppliedOutages();
result.setEffectiveStart(outageDate);
// apply outages to model
log.trace("Apply outages for " + formatter.format(outageDate.getTime()));
// keep the list of applied outages for later evaluation
for (Outage outage : outages) {
result.incramentExaminedOutages();
if (outage.getEffectiveStartHour().toGregorianCalendar().compareTo(outageDate) <= 0 && outageDate.compareTo(outage.getEffectiveEndHour().toGregorianCalendar()) <= 0) {
result.incramentOutagesInDateRange();
OutageModel.OutageMatch outageMatch = OutageModel.match(outage, model, logDetail);
if (OutageModel.applyOutage(outage, outageMatch, logDetail)) {
result.getAppliedOutages().add(outage);
if (result.getEffectiveEnd() == null || result.getEffectiveEnd().compareTo(outage.getEffectiveEndHour().toGregorianCalendar()) > 0) result.setEffectiveEnd((GregorianCalendar)outage.getEffectiveEndHour().toGregorianCalendar().clone());
result.incramentOutagesApplied();
} else {
result.incramentOutagesNotApplied();
}
}
}
log.trace("Examined " + result.getExaminedOutages() + " outage(s)");
log.trace("" + result.getOutagesInDateRange() + " outage(s) in date range");
log.trace("Applied " + result.getOutagesApplied() + " outage(s) in date range");
log.trace("Did not apply " + result.getOutagesNotApplied() + " outage(s) in date range");
return result;
}
示例9: searchNormalEarliestAppointment
import java.util.Calendar; //導入方法依賴的package包/類
private boolean searchNormalEarliestAppointment(List<AvailableAppointment> availableAppointmentList) {
AvailableAppointment earliestAvappt = null;
Calendar minCalendar = null;
for(AvailableAppointment avappt : availableAppointmentList) {
Entry<Calendar, Map<Integer, List<Time>>> earliestYearMonthEntry = avappt.timeMap.entrySet().iterator().next();
Calendar earliestYearMonth = earliestYearMonthEntry.getKey();
if(!earliestYearMonthEntry.getValue().entrySet().isEmpty()) {
Entry<Integer, List<Time>> earliestDateEntry = earliestYearMonthEntry.getValue().entrySet().iterator().next();
int earliestDate = earliestDateEntry.getKey();
if(!earliestDateEntry.getValue().isEmpty()) {
Time earliestTime = earliestDateEntry.getValue().get(0);
Calendar cal = Calendar.getInstance();
cal.set(earliestYearMonth.get(Calendar.YEAR), earliestYearMonth.get(Calendar.MONTH), earliestDate,
earliestTime.getHour(), earliestTime.getMinute());
if(minCalendar == null || cal.compareTo(minCalendar) < 0) {
minCalendar = cal;
earliestAvappt = avappt;
}
}
}
}
if(minCalendar != null) {
saveAsSearchResult(minCalendar, earliestAvappt.testCenter);
return true;
} else {
return false;
}
}
示例10: searchRangeEarliestAppointment
import java.util.Calendar; //導入方法依賴的package包/類
private boolean searchRangeEarliestAppointment(List<AvailableAppointment> availableAppointmentList) {
AvailableAppointment earliestAvappt = null;
Calendar minCalendar = null;
Time minTime = new Time(startCalendar.get(Calendar.HOUR_OF_DAY), startCalendar.get(Calendar.MINUTE));
Time maxTime = new Time(endCalendar.get(Calendar.HOUR_OF_DAY), endCalendar.get(Calendar.MINUTE));
for(AvailableAppointment avappt : availableAppointmentList) {
Entry<Calendar, Map<Integer, List<Time>>> earliestYearMonthEntry = avappt.timeMap.entrySet().iterator().next();
Calendar earliestYearMonth = earliestYearMonthEntry.getKey();
if(!earliestYearMonthEntry.getValue().entrySet().isEmpty()) {
Entry<Integer, List<Time>> earliestDateEntry = earliestYearMonthEntry.getValue().entrySet().iterator().next();
int earliestDate = earliestDateEntry.getKey();
if(!earliestDateEntry.getValue().isEmpty()) {
Time earliestTime = null;
for(Time time : earliestDateEntry.getValue()) {
if(minTime.compareTo(time)<1 && time.compareTo(maxTime)<1) {
earliestTime = time;
break;
}
}
if(earliestTime != null) {
Calendar cal = Calendar.getInstance();
cal.set(earliestYearMonth.get(Calendar.YEAR), earliestYearMonth.get(Calendar.MONTH), earliestDate,
earliestTime.getHour(), earliestTime.getMinute());
if(minCalendar == null || cal.compareTo(minCalendar) < 0) {
minCalendar = cal;
earliestAvappt = avappt;
}
}
}
}
}
if(minCalendar != null) {
saveAsSearchResult(minCalendar, earliestAvappt.testCenter);
return true;
} else {
return false;
}
}
示例11: getRepeatingReminderNextCalendar
import java.util.Calendar; //導入方法依賴的package包/類
public static Calendar getRepeatingReminderNextCalendar(RepeatingReminder repeatingReminder) {
Calendar today = Calendar.getInstance();
Calendar endDate = getRepeatingReminderEndCalendar(repeatingReminder);
Calendar cal = CalendarUtil.getCalendarFromDateAndTime( repeatingReminder.getDate(), repeatingReminder.getTime());
//TODO: Cant use getDateFieldFromRepeatType(), Gives off a weird warning
//final int dateField = getDateFieldFromRepeatType(repeatingReminder.getRepeatType());
while(true) {
if (cal.compareTo(endDate) >= 0) //If cal passed endDate, reminder is overdue, return null
return null;
if(cal.compareTo(today) >= 0) {
return cal;
}
//TODO: Cant use getDateFieldFromRepeatType(), Gives off a weird warning
//cal.add(dateField, repeatingReminder.getRepeatInterval()); break;
switch (repeatingReminder.getRepeatType()) {
case DAILY: cal.add(Calendar.DAY_OF_WEEK, repeatingReminder.getRepeatInterval()); break;
case WEEKLY: cal.add(Calendar.WEEK_OF_YEAR, repeatingReminder.getRepeatInterval()); break;
case MONTHLY: cal.add(Calendar.MONTH, repeatingReminder.getRepeatInterval()); break;
case YEARLY: cal.add(Calendar.YEAR, repeatingReminder.getRepeatInterval()); break;
default: throw new InvalidParameterException("Invalid RepeatType parameter in TaskUtil.getRepeatingReminderEndCalendar()");
}
}
}
示例12: expiryDateCustomSelected
import java.util.Calendar; //導入方法依賴的package包/類
private void expiryDateCustomSelected() {
final Calendar today = Calendar.getInstance();
final Calendar yesterday = Calendar.getInstance();
yesterday.add(Calendar.DAY_OF_YEAR, -1);
final Calendar calendar = Calendar.getInstance();
int currentDay = calendar.get(Calendar.DAY_OF_MONTH);
int currentMonth = calendar.get(Calendar.MONTH);
int currentYear = calendar.get(Calendar.YEAR);
DatePickerDialog datePickerDialog = new DatePickerDialog(getContext(),
new DatePickerDialog.OnDateSetListener() {
@Override
public void onDateSet(DatePicker datePicker, int i, int i1, int i2) {
clearExpiryDateString();
calendar.set(Calendar.DAY_OF_MONTH, datePicker.getDayOfMonth());
calendar.set(Calendar.MONTH, datePicker.getMonth());
calendar.set(Calendar.YEAR, datePicker.getYear());
mExpiryDate = calendar;
if (calendar.compareTo(today) == 0) {
mExpiryDateSpinner.setSelection(
mExpiryDateAdapter.getPosition(
getString(R.string.edit_date_today)));
} else if (calendar.compareTo(yesterday) == 0) {
mExpiryDateSpinner.setSelection(
mExpiryDateAdapter.getPosition(
getString(R.string.edit_date_yesterday)));
} else {
mExpiryDateString = getSimpleDateFormat().format(calendar.getTime());
mExpiryDateAdapter.insert(mExpiryDateString, 0);
mExpiryDateSpinner.setSelection(0);
}
if (mExpiryDateListener) {
mPresenter.itemChanged();
}
}
}, currentYear, currentMonth, currentDay);
datePickerDialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
@Override
public void onCancel(DialogInterface dialogInterface) {
mExpiryDateSpinner.setSelection(mPreviousExpiryDateOption);
}
});
datePickerDialog.show();
}
示例13: getViewAt
import java.util.Calendar; //導入方法依賴的package包/類
@Override
public RemoteViews getViewAt(int position) {
RemoteViews rv = new RemoteViews(mContext.getPackageName(), R.layout.widget_item);
if (position < mItems.size()) {
String category = mItems.get(position).getCategory();
if (category == null || category.equals("")) {
rv.setTextViewText(R.id.category, getString(R.string.edit_category_empty));
} else {
rv.setTextViewText(R.id.category, category);
}
String type = mItems.get(position).getType();
if (type == null || type.equals("")) {
rv.setTextViewText(R.id.type, getString(R.string.edit_type_empty));
} else {
rv.setTextViewText(R.id.type, type);
}
String colour = mItems.get(position).getMainColour();
if (colour == null || colour.equals("")) {
rv.setTextViewText(R.id.colour, getString(R.string.edit_main_colour_empty));
} else {
rv.setTextViewText(R.id.colour, colour);
}
long expiry = mItems.get(position).getExpiry();
if (expiry == -1) {
setTextColourPrimary(rv);
rv.setTextViewText(R.id.expiry, getString(R.string.edit_expiry_date_empty));
} else {
Calendar expiryDate = Calendar.getInstance();
expiryDate.setTimeInMillis(expiry);
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(getString(
R.string.edit_date_format),
Locale.ENGLISH);
String expiryString = simpleDateFormat.format(expiryDate.getTime());
rv.setTextViewText(R.id.expiry, expiryString);
Calendar almostExpiredDate = Calendar.getInstance();
almostExpiredDate.add(Calendar.MONTH, 1);
if (expiryDate.compareTo(Calendar.getInstance()) < 1) {
rv.setInt(R.id.expiry, "setTextColor", ContextCompat.getColor(mContext,
R.color.red));
} else if (expiryDate.compareTo(almostExpiredDate) < 1) {
rv.setInt(R.id.expiry, "setTextColor", ContextCompat.getColor(mContext,
R.color.orange));
} else {
setTextColourPrimary(rv);
}
}
int price = mItems.get(position).getPricePaid();
String priceString;
if (price == -1) {
priceString = getString(R.string.edit_price_paid_empty);
} else {
priceString = getString(R.string.edit_price_paid_prefix)
+ getPriceFromTotalCents(price);
}
rv.setTextViewText(R.id.paid, priceString);
Intent fillInIntent = new Intent();
fillInIntent.putExtra(EXTRA_ITEM_ID, mItems.get(position).getId());
rv.setOnClickFillInIntent(R.id.widget_item, fillInIntent);
}
return rv;
}
示例14: onBindViewHolder
import java.util.Calendar; //導入方法依賴的package包/類
@Override
public void onBindViewHolder(ViewHolder holder, int position) {
if (mLargeScreen) {
String imageUrl = mItems.get(position).getImageUrl();
if (imageUrl != null) {
if (!imageUrl.equals(mImageUrl)) {
mImageUrl = imageUrl;
}
holder.mItemImage.setVisibility(View.VISIBLE);
// EspressoIdlingResource.increment();
Glide.with(getContext())
.load(imageUrl)
.crossFade()
.centerCrop()
.diskCacheStrategy(DiskCacheStrategy.ALL)
.into(new GlideDrawableImageViewTarget(holder.mItemImage) {
@Override
public void onResourceReady(GlideDrawable resource,
GlideAnimation<? super GlideDrawable> animation) {
super.onResourceReady(resource, animation);
// EspressoIdlingResource.decrement();
}
});
} else {
holder.mItemImage.setVisibility(View.GONE);
}
}
String category = mItems.get(position).getCategory();
if (category == null || category.equals("")) {
holder.mCategory.setText(getString(R.string.edit_category_empty));
} else {
holder.mCategory.setText(category);
}
String type = mItems.get(position).getType();
if (type == null || type.equals("")) {
holder.mType.setText(getString(R.string.edit_type_empty));
} else {
holder.mType.setText(mItems.get(position).getType());
}
String colour = mItems.get(position).getMainColour();
if (colour == null || colour.equals("")) {
holder.mColour.setText(getString(R.string.edit_main_colour_empty));
} else {
holder.mColour.setText(mItems.get(position).getMainColour());
}
long expiry = mItems.get(position).getExpiry();
if (expiry == -1) {
setTextColourPrimary(holder);
holder.mExpiry.setText(getString(R.string.edit_expiry_date_empty));
} else {
Calendar expiryDate = Calendar.getInstance();
expiryDate.setTimeInMillis(expiry);
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(getString(
R.string.edit_date_format), Locale.ENGLISH);
String expiryString = simpleDateFormat.format(expiryDate.getTime());
holder.mExpiry.setText(expiryString);
Calendar almostExpiredDate = Calendar.getInstance();
almostExpiredDate.add(Calendar.MONTH, 1);
if (expiryDate.compareTo(Calendar.getInstance()) < 1) {
holder.mExpiry.setTextColor(ContextCompat.getColor(getContext(), R.color.red));
} else if (expiryDate.compareTo(almostExpiredDate) < 1) {
holder.mExpiry.setTextColor(ContextCompat.getColor(getContext(), R.color.orange));
} else {
setTextColourPrimary(holder);
}
}
int price = mItems.get(position).getPricePaid();
String priceString;
if (price == -1) {
priceString = getString(R.string.edit_price_paid_empty);
} else {
priceString = getString(R.string.edit_price_paid_prefix)
+ getPriceFromTotalCents(price);
}
holder.mPaid.setText(priceString);
}
示例15: purchaseDateCustomSelected
import java.util.Calendar; //導入方法依賴的package包/類
private void purchaseDateCustomSelected() {
final Calendar today = Calendar.getInstance();
final Calendar yesterday = Calendar.getInstance();
yesterday.add(Calendar.DAY_OF_YEAR, -1);
final Calendar calendar = Calendar.getInstance();
int currentDay = calendar.get(Calendar.DAY_OF_MONTH);
int currentMonth = calendar.get(Calendar.MONTH);
int currentYear = calendar.get(Calendar.YEAR);
DatePickerDialog datePickerDialog = new DatePickerDialog(getContext(),
new DatePickerDialog.OnDateSetListener() {
@Override
public void onDateSet(DatePicker datePicker, int i, int i1, int i2) {
clearPurchaseDateString();
calendar.set(Calendar.DAY_OF_MONTH, datePicker.getDayOfMonth());
calendar.set(Calendar.MONTH, datePicker.getMonth());
calendar.set(Calendar.YEAR, datePicker.getYear());
mPurchaseDate = calendar;
if (calendar.compareTo(today) == 0) {
mPurchaseDateSpinner.setSelection(
mPurchaseDateAdapter.getPosition(
getString(R.string.edit_date_today)));
} else if (calendar.compareTo(yesterday) == 0) {
mPurchaseDateSpinner.setSelection(
mPurchaseDateAdapter.getPosition(
getString(R.string.edit_date_yesterday)));
} else {
mPurchaseDateString = getSimpleDateFormat().format(calendar.getTime());
mPurchaseDateAdapter.insert(mPurchaseDateString, 0);
mPurchaseDateSpinner.setSelection(0);
}
if (mPurchaseDateListener) {
mPresenter.itemChanged();
}
}
}, currentYear, currentMonth, currentDay);
datePickerDialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
@Override
public void onCancel(DialogInterface dialogInterface) {
mPurchaseDateSpinner.setSelection(mPreviousPurchaseDateOption);
}
});
datePickerDialog.show();
}