我想將日期和時間轉換爲毫秒。我正在使用此代碼來轉換它們。將DateTime轉換爲毫秒
final TimePicker time = (TimePicker) findViewById(R.id.timePicker1);
final DatePicker date = (DatePicker) findViewById(R.id.datePicker1);
final Calendar calendar = Calendar.getInstance();
calendar.set(date.getYear(), date.getMonth(),
date.getDayOfMonth(), time.getCurrentHour(),
time.getCurrentMinute(), 0);
final long startTime = calendar.getTimeInMillis();
但它沒有給我正確的價值。例如,如果我想轉換這個「Sep 23 2000 02:45 AM」 它給了我這個值「」。但是這個值是不是喜歡在這些網站
http://www.ruddwire.com/handy-code/date-to-millisecond-calculators/
然後我嘗試給我們time.getCurrentHour() + 5
因爲我目前的位置是GMT + 5但簡化版,它給了我正確的結果。我如何獲得日期+時間的正確值爲毫秒?