Date
オブジェクトで再生するために私のアプリでjoda
APIを使用しようとしています。私は次のコード2つのJoda日付の差を秒単位で取得
prefsEdit.putLong(context.getString(R.string.last_status_change_time_key) , DateTime.now().getMillis());
を用いsharedpreference
でjoda
日時を記憶していますいくつかの活動において
、IMこの格納された嗜好をフェッチし、次のコード
long lastStatusChangeTime = objSharedPref.GetAppLongPrefByKey(R.string.last_status_change_time_key);
DateTime now = DateTime.now();
DateTime dateTime = new DateTime(lastStatusChangeTime);
Seconds seconds = Seconds.secondsBetween(now, dateTime);
int n = seconds.getSeconds();
を使用して日付の間の差を計算します
コードは常にminus
の値を返します。たとえば、-31
、-12
などです。
違いが正しく計算されていません。
何が欠けていますか?
secondsBetween()