我需要在日歷中的選定日期槽上添加 24 小時(以毫秒為單位)。在下面的代碼中,如果我添加 24 小時,它會給我同一天的 00:00 時間,所以我嘗試使用這個(23,分鐘:59,秒:59)這是錯誤的。請建議....
DateTime initialTime = selectedDate.value;
DateTime finalTime = selectedDate.value.add(new Duration(hours: 23,minutes: 59,seconds: 59));
int finalTimeInEpoch = finalTime.millisecondsSinceEpoch;
print('This is the initial time for selected day --> $initialTime and This is the final time for selected day --> $finalTime');
int initialTimeForApi = initialTime.millisecondsSinceEpoch;
int finalTimeForApi= finalTimeInEpoch;
print('This is the initial time for selected day --> ${initialTime.millisecondsSinceEpoch} and This is the final time for selected day --> $finalTimeInEpoch in millisecondsSinceEpoch');
uj5u.com熱心網友回復:
像這樣使用
DateTime finalTime = selectedDate.value.add(Duration(hours: 24));
如果這不能解決問題,則您的問題selectedDate.value不是有效的格式日期時間
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/518262.html
標籤:扑镖
