1. 程式人生 > >選擇日期的Dialog post datetime到 API 後臺 時區不正確時處理

選擇日期的Dialog post datetime到 API 後臺 時區不正確時處理

private void initReceiptDialog() {
        if (mReceiptDialog == null) {
            mReceiptDialog = Factory.getInstance().getDialogFactory().createSelectDateDialog(mActivity);
            mReceiptDialog.setMaxYear(Calendar.getInstance().get(Calendar.YEAR));
            mReceiptDialog.setMinYear(2000);
            mReceiptDialog.setMinMonth(1);
            mReceiptDialog.setMinDay(1);
            mReceiptDialog.setLessCurrentTime(true);
            mReceiptDialog.setOnSelectedListener(new SelectDateDialog.OnSelectedListener() {
                @Override
                public void onSelected(String year, String month, String day) {
                    Calendar calendar = Calendar.getInstance();
                    calendar.set(Integer.parseInt(year), Integer.parseInt(month)-1, Integer.parseInt(day));
                    mReceiptDate = calendar.getTime().getTime();
                    mLltvReceiptDate.setContentText(InfoFormatUtils.formatDateMiddleline(mReceiptDate));
                }

                @Override
                public void onCancel() {

                }
            });
        }
        mReceiptDialog.show(mReceiptDate);
    }