-1
嘿,我有一個問題:時間長負
日誌:
04-26 11:29:09.332 21657-21784/com.grou D/answer: -3600000
04-26 11:29:09.332 21657-21784/com.grou D/answer: 12:00:00
代碼:
SimpleDateFormat dateFormat = new SimpleDateFormat("hh:mm:ss");
Date parsedDate = dateFormat.parse(TimeEnd);
Timestamp timestamp = new java.sql.Timestamp(parsedDate.getTime());
tsTimeEnd = timestamp.getTime();
Log.d("answer",Long.toString(timestamp.getTime()));
timestamp.setTime(tsTimeEnd);
Log.d("answer",dateFormat.format(timestamp));
爲什麼-3600000? :(
解決方案:
我是在24小時內,我把HH或它的HH如此12:00:00這是正常的比negatif
究竟是你想要做的B/N兩個日期嗎? – Rajasekhar
http://stackoverflow.com/questions/15003498/why-does-simpledateformat-parse-gettime-return-an-incorrect - 負值 –
Nop不工作相同的問題小時是:-1.0 – Royalxm