I want to compare(finding remaining days and time between two days) using joda time. I am taking two DateTime object like this(one is starting and another is ending)
If you want the output in prettier format then you can use this snippet too
val startDate = DateTime.now()
val endDate = DateTime(endTime)
val period = Period(startDate, endDate)
val periodFormatter = PeriodFormatterBuilder().apply {
when {
period.days > 0 -> appendDays().appendSuffix(" day", " days")
period.hours > 0 -> appendHours().appendSuffix(" hour", " hours")
period.minutes > 0 -> appendMinutes().appendSuffix(" minute", " minutes")
}
}.toFormatter()
periodFormatter.print(period)