关于android:Epoch和日期时间与Picker完全关闭

Epoch and Date Time with Picker is completely off

我有一个DatePicker和一个TimePicker。 我正在使用它们两者一起将epoch格式的日期设置到我的后端。 但是当我将计算出的时代转换为完全关闭时。

在我的onCreate

1
2
3
4
5
6
7
8
9
10
11
12
    whenToTravel = today = Calendar.getInstance();
    travelDate = (LinearLayout) findViewById(R.id.travelDate);
    travelDate.setOnClickListener(this);
    datePicker = new DatePickerDialog(this, this, today.get(Calendar
            .YEAR), today.get(Calendar.MONTH), today.get(Calendar
            .DAY_OF_MONTH));
    selectedDate = (TextView) findViewById(R.id.selectedDate);
    travelTime = (LinearLayout) findViewById(R.id.travelTime);
    travelTime.setOnClickListener(this);
    timePicker = new TimePickerDialog(this, this, today.get(Calendar
            .HOUR_OF_DAY), today.get(Calendar.MINUTE), false);
    selectedTime = (TextView) findViewById(R.id.selectedTime);

在我的onDateSetonTimeSet

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
@Override
public void onDateSet(DatePicker datePicker, int year, int monthOfYear,
                      int dayOfMonth) {
    whenToTravel.set(Calendar.YEAR, year);
    whenToTravel.set(Calendar.MONTH, monthOfYear);
    whenToTravel.set(Calendar.DAY_OF_MONTH, dayOfMonth);
    selectedDate.setText(DATE_FORMAT.format(whenToTravel.getTime()));
    //monthOfYear   int: The month that was set (0-11) for compatibility
    //with Calendar.
}

@Override
public void onTimeSet(TimePicker timePicker, int hour, int minute) {
    whenToTravel.set(Calendar.HOUR_OF_DAY, hour);
    whenToTravel.set(Calendar.MINUTE, minute);
    selectedTime.setText(TIME_FORMAT.format(whenToTravel.getTime()));
}

现在,当我设置31-May-2016 10:01 AM时,我得到1464710433243作为时代。 使用http://www.epochconverter.com/。 我明白了

Assuming that this timestamp is in milliseconds:
GMT: Tue, 31 May 2016 16:00:33.243 GMT
Your time zone: 31/05/2016, 21:30:33 GMT+5:30

我假设我的时区将返回31/05/2016, 10:01:33 GMT+5:30

我在这里错过了什么?


我认为这是有效的,我做了一个改变,现在读了

Assuming that this timestamp is in milliseconds:
GMT: Wed, 01 Jun 2016 04:31:23.256 GMT
Your time zone: 01/06/2016, 10:01:23 GMT+5:30

1
2
whenToTravel = today = Calendar.getInstance() ;
today.setTime(new Date(System.currentTimeMillis())) ;