我使用Android Studio。我想计算自我指定日期起280天后的那一天。
Calendar thatDay = Calendar.getInstance(); //today date
thatDay.set(Calendar.DAY_OF_MONTH,selectedday);
thatDay.set(Calendar.MONTH,selectedmonth-1); // 0-11 so 1 less
thatDay.set(Calendar.YEAR, selectedyear);
Calendar afterday= Calendar.getInstance(); //280 after date
afterday.set(Calendar.DAY_OF_MONTH,selectedday+10);
afterday.set(Calendar.MONTH,selectedmonth+8);
afterday.set(Calendar.YEAR, selectedyear);
Log.e(" After Day: ", " days:" + (afterday.getTimeInMillis()- thatDay.getTimeInMillis())/ (24 * 60 * 60 * 1000));
日志输出变量。有时285,283,279种
答案 0 :(得分:2)
只需func stringFromPossibleEnum(possibleEnum: Any) -> String? {
if let e = possibleEnum as? StringRawRepresentable { return e.stringRawValue }
return nil
}
stringFromPossibleEnum(possibleEnum: E2.two as Any)
答案 1 :(得分:0)
#$0