Dùng Calendar.current.date(byAdding:value:to:):
let date = Date()
let addedDate = Calendar.current.date(byAdding: .day, value: 1, to: date)
print(addedDate ?? "")
Có thể cộng/trừ .month, .year, .hour... tương tự.
Dùng Calendar.current.date(byAdding:value:to:):
let date = Date()
let addedDate = Calendar.current.date(byAdding: .day, value: 1, to: date)
print(addedDate ?? "")
Có thể cộng/trừ .month, .year, .hour... tương tự.