Date
개체를 가지고 놀고 싶은데 내 앱에 joda
API를 사용하려고합니다. sharedpreference
에 난 joda
날짜를 저장하고 어떤 작업에서는 초 단위의 두 Joda 날짜의 차이를 가져 오십시오.
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();
다음이 저장 환경을 페치 및 사용 기간의 차이를 산출하는 다른 활동 이제 다음 코드
prefsEdit.putLong(context.getString(R.string.last_status_change_time_key) , DateTime.now().getMillis());
를 사용
코드는 항상 minus
의 값을 반환합니다 (예 : -31
, -12
등).
차이가 올바르게 계산되지 않습니다.
무엇이 없습니까 ??